libft_old/extended_libft/ft_strlcpy.c
Willem Haffmans 326f52308e all
2024-07-26 22:32:04 +02:00

32 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/05 18:42:10 by whaffman #+# #+# */
/* Updated: 2024/07/09 22:24:19 by whaffman ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dest, const char *src, size_t size)
{
size_t i;
size_t result;
i = 0;
if (size == 0)
return (ft_strlen(src));
while (src[i] && i < size - 1)
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
result = ft_strlen(src);
return (result);
}