---
name: "stralloc_copyb"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/stralloc_copyb"
---

# stralloc\_copyb(3)

copy data into a stralloc

## NAME

stralloc\_copyb - copy data into a stralloc

## SYNTAX

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

int **stralloc\_copyb**(stralloc\* *sa*,const char\* *buf*,size\_t *len*);

## DESCRIPTION

stralloc\_copyb makes sure that *sa* has enough space allocated to hold *len* bytes.  Then it copies the first *len* bytes from *buf* into the stralloc.

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.
