Everything

strncpy


Copies a source string of a specified length to a destination storage area.

[Format]

#include <string.h>

char *strncpy (char *s1, const char *s2, size_t n);

[Parameters]

s1 Pointer to destination storage area

s2 Pointer to source string

n Number of characters to be copied

[Return values]

s1 value

[Remarks]

The strncpy function copies up to n characters from the beginning of the string pointed by s2 to a storage area pointed by s1. If the length of the string specified by s2 is shorter than n characters, the function elongates the string to the length by padding with null characters.

If the length of the string specified by s2 is longer than n characters, the copied string in s1 storage area ends with a character other than the null character.