Next: , Previous: , Up: ISO C and POSIX Function Substitutes   [Contents][Index]

10.1103 strncpy

POSIX specification:

Gnulib module: string

Portability problems fixed by Gnulib:

Portability problems not fixed by Gnulib:

Note: This function was designed for the use-case of filling a fixed-size record with a string, before writing it to a file. This function is not appropriate for copying a string into a bounded memory area, because you have no guarantee that the result will be NUL-terminated. Even if you add the NUL byte at the end yourself, this function is inefficient (as it spends time clearing unused memory) and will allow silent truncation to occur, which is not a good behavior for GNU programs. For more details, see