get_next_line/ft_strdup.c

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbrochar <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/25 14:47:23 by gbrochar #+# #+# */
/* Updated: 2016/04/09 21:27:37 by gbrochar ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s1)
{
char *dest;
int i;
i = 0;
dest = ft_strnew(ft_strlen(s1));
while (s1[i])
{
dest[i] = s1[i];
i++;
}
dest[i] = '\0';
return (dest);
}