32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strncpy.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: tchivert <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2019/04/04 18:40:08 by tchivert #+# #+# */
|
|
/* Updated: 2019/09/04 05:13:33 by tchivert ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
char *ft_strncpy(char *dest, const char *src, size_t len)
|
|
{
|
|
unsigned int i;
|
|
|
|
i = 0;
|
|
while (i < len && src[i])
|
|
{
|
|
dest[i] = src[i];
|
|
i++;
|
|
}
|
|
while (i < len)
|
|
{
|
|
dest[i] = '\0';
|
|
i++;
|
|
}
|
|
return (dest);
|
|
}
|