42_libft/ft_strlcpy.c
Camille Chauvet 1d0f0b1901 m
2022-09-27 16:29:23 +02:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/27 16:24:15 by cchauvet #+# #+# */
/* Updated: 2022/09/27 16:29:08 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *strlcpy(char *dst, const char *src, size_t size)
{
char *str;
size_t i;
i = 0;
str = (char *) src;
while (str[i + 1] && dst[i + 1] && i < size - 1)
{
dst[i] = src[i];
i++;
}
dst[i] = 0;
return (dst);
}