libft
|
Go to the source code of this file.
Functions | |
char * | ft_strndup (const char *s1, size_t len) |
Makes a new string and copies up to len characters to it. More... | |
char* ft_strndup | ( | const char * | s1, |
size_t | len | ||
) |
Makes a new string and copies up to len
characters to it.
Allocate sufficient memory for a string of len
characters, do the copy of len
characters, NULL
terminate the string, and return a pointer to it. The pointer may subsequently be used as an argument to the function free
.
s1 | String to be copied from. |
len | Number of characters to copy. |
len
with copied characters or NULL
if allocation failed. s1
contains less than len
characters, behaviour is undefined. Definition at line 30 of file ft_strndup.c.