ft_strndup & delete -std=c99

This commit is contained in:
Tanguy MAZE
2018-04-23 15:48:28 +02:00
parent be93518e9b
commit 4f3eb001b9
8 changed files with 37 additions and 14 deletions

22
ft_strndup.c Normal file
View File

@@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strndup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/23 15:44:36 by tmaze #+# #+# */
/* Updated: 2018/04/23 15:45:12 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strndup(const char *s1, size_t n)
{
char *ret;
if ((ret = ft_strnew(n)) != NULL)
ft_strncpy(ret, s1, n);
return (ret);
}