stpncpy()
Copy a fixed-length string and return a pointer to the end of the result
Synopsis:
#include <string.h>
char * stpncpy( char * restrict dst,
const char * restrict src,
size_t num);
Arguments:
- dst
- A pointer to where you want to copy the string.
- src
- The string that you want to copy.
- num
- The maximum number of characters that you want to copy.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The stpncpy() function copies no more than num characters from the string pointed to by src into the array pointed to by dst. If the string pointed to by src is shorter than num characters, null characters are appended to the copy in the array pointed to by dst, until num characters in all have been written. If the string pointed to by src is longer than num characters, then the result isn't terminated by a null character.
Returns:
If a NUL character is written to the destination, stpncpy() returns the address of the first
such NUL character. Otherwise, it returns &dst[num]
.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |