welibc
A clear, secure, and well documented standard C library
|
Defines the strncpy function. More...
#include <string.h>
Go to the source code of this file.
Functions | |
char * | strncpy (char *s1, const char *s2, size_t n) |
Copies no more than n characters with null terminator from s2 to s1. More... | |
Defines the strncpy function.
Definition in file strncpy.c.
char* strncpy | ( | char * | s1, |
const char * | s2, | ||
size_t | n | ||
) |
Copies no more than n characters with null terminator from s2 to s1.
*s1 | The destination array |
*s2 | The source string |
n | Maximum number of characters to copy |
The strncpy function copies not more than n characters (characters that follow a null character are not copied) from the array pointed to by s2 to the array pointed to be s1. If the array pointed to by s2 is a string that is shorter than n characters, null characters are appended to the copy in the array pointed to by s1, until n characters in all have been written.
Definition at line 58 of file strncpy.c.
References memmove(), memset(), strcpy(), and strlen().