42_minitalk/libftx/libft/ft_strlcpy.c

29 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-01-23 07:22:30 -05:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/27 16:24:15 by cchauvet #+# #+# */
/* Updated: 2022/09/28 17:23:27 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, const char *src, size_t size)
{
size_t i;
i = 0;
while (i + 1 < size && src[i])
{
dst[i] = src[i];
i++;
}
if (size)
dst[i] = 0;
return (ft_strlen(src));
}