42/my_bsq/lib_src/ft_strncpy.c
2016-11-20 02:20:23 +02:00

29 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/31 16:59:01 by gtertysh #+# #+# */
/* Updated: 2016/11/01 20:11:02 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
char *start;
unsigned int i;
start = dest;
i = 0;
while (i < n && *src)
{
*dest = *src;
dest++;
src++;
i++;
}
*dest = '\0';
return (start);
}