Name

strscpy_pad — Copy a C-string into a sized buffer

Synopsis

ssize_t strscpy_pad (char * dest,
 const char * src,
 size_t count);
 

Arguments

dest

Where to copy the string to

src

Where to copy the string from

count

Size of destination buffer

Description

Copy the string, or as much of it as fits, into the dest buffer. The behavior is undefined if the string buffers overlap. The destination buffer is always NUL terminated, unless it's zero-sized.

If the source string is shorter than the destination buffer, zeros the tail of the destination buffer.

For full explanation of why you may want to consider using the 'strscpy' functions please see the function docstring for strscpy.

Return

The number of characters copied (not including the trailing NUL) or -E2BIG if the destination buffer wasn't big enough.