-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strndup.c
25 lines (22 loc) · 1.06 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
24
25
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strndup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmoska <tmoska@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/27 22:39:08 by tmoska #+# #+# */
/* Updated: 2017/02/27 23:13:40 by tmoska ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
char *ft_strndup(char *src, size_t size)
{
char *str;
if ((str = ft_strnew(size)))
ft_strncpy(str, src, size);
else
return (0);
return (str);
}