---
name: "stralloc_copy"
section: "3diet"
platform: "linux"
package: "libowfat-dev"
version: "0.28-2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/stralloc_copy/3diet"
---

# stralloc\_copy(3diet)

copy data into a stralloc

## NAME

stralloc\_copy - copy data into a stralloc

## SYNTAX

**#include \<stralloc.h\>**

int **stralloc\_copy**(stralloc\* *sato*,stralloc\* *safrom*);

## DESCRIPTION

stralloc\_copy copies the string stored in *safrom* into *sa*. It is the same as **stralloc\_copyb**(&*sato*, *safrom*.s, *safrom*.len). *safrom* must already be allocated.

The data that *sa* previously contained is overwritten and truncated.

If stralloc\_copy has trouble allocating memory, it returns 0.  Otherwise it returns 1.

## RETURN VALUE

1 for success, 0 on memory allocation failure.

## SEE ALSO

[stralloc\_copyb(3)](/stralloc_copyb/3.md)
