-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strndup.c
23 lines (20 loc) · 1.03 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
22
23
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strndup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nhennigh <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/15 20:47:43 by nhennigh #+# #+# */
/* Updated: 2019/02/15 20:48:52 by nhennigh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strndup(const char *s1, size_t n)
{
char *tmp;
if (!(tmp = ft_strnew(n)))
return (NULL);
ft_strncpy(tmp, s1, n);
return (tmp);
}