fillit/libft/ft_strncpy.c
Gregory Tertyshny d1cabbc8d5 initial commit
2016-12-26 18:48:33 +02:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/30 13:12:41 by gtertysh #+# #+# */
/* Updated: 2016/11/30 14:39:28 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncpy(char *dst, const char *src, size_t len)
{
char *new_dest;
new_dest = dst;
while (len && *src)
{
*new_dest++ = *src++;
if (!len)
return (dst);
len--;
}
while (len-- > 0)
*(new_dest++) = '\0';
return (dst);
}