Scroll to navigation

ustrzncpy(3alleg4) Allegro manual ustrzncpy(3alleg4)

NAME

ustrzncpy - Copies a string into another one, specifying size. Allegro game programming library.

SYNOPSIS

#include <allegro.h>

char *ustrzncpy(char *dest, int size, const char *src, int n);

DESCRIPTION

This function is like ustrzcpy() except that no more than `n' characters from `src' are copied into `dest' whose length in bytes is specified by `size' and which is guaranteed to be null-terminated even if `src' is bigger than `size'. If `src' is shorter than `n' characters, null characters are appended to `dest' as padding until `n' characters have been written. In any case, `dest' is guaranteed to be null-terminated.

Note that, even for empty strings, your destination string must have at least enough bytes to store the terminating null character of the string, and your parameter `size' must reflect this. Otherwise, the debug version of Allegro will abort at an assertion, and the release version of Allegro will overrun the destination buffer.

RETURN VALUE

The return value is the value of `dest'.

SEE ALSO

uconvert(3alleg4), ustrzcpy(3alleg4), ustrncpy(3alleg4), exkeys(3alleg4)

version 4.4.3 Allegro