32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strncpy.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: scebula <scebula@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2015/11/24 21:13:38 by scebula #+# #+# */
|
|
/* Updated: 2015/12/04 00:30:48 by scebula ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
char *ft_strncpy(char *dst, const char *src, size_t n)
|
|
{
|
|
size_t i;
|
|
|
|
i = 0;
|
|
while (src[i] && i < n)
|
|
{
|
|
dst[i] = src[i];
|
|
i++;
|
|
}
|
|
while (i < n)
|
|
{
|
|
dst[i] = '\0';
|
|
i++;
|
|
}
|
|
return (dst);
|
|
}
|