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

# stralloc\_copys(3diet)

copy data into a stralloc

## NAME

stralloc\_copys - copy data into a stralloc

## SYNTAX

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

int **stralloc\_copys**(stralloc\* *sa*,const char\* *buf*);

## DESCRIPTION

stralloc\_copys copies a \\0-terminated string from *buf* into *sa*, without the \\0. It is the same as **stralloc\_copyb**(&*sa*, *buf*, str\_len(*buf*)).

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

If stralloc\_copys runs out of memory, stralloc\_copys leaves *sa* alone and return 0, otherwise it returns 1.

## RETURN VALUE

1 for success, 0 on memory allocation failure.

## SEE ALSO

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