-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strndup.c
21 lines (18 loc) · 1.02 KB
/
ft_strndup.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strndup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tparand <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/10 16:46:19 by tparand #+# #+# */
/* Updated: 2017/11/21 15:53:48 by tparand ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strndup(const char *s, size_t n)
{
char *new_s;
new_s = ft_strnew(n);
return (!new_s ? NULL : ft_memcpy(new_s, s, n));
}