42_C_PISCINE/C/c03v1/ex05/ft_strlcat.c

30 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-05-17 12:45:25 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/21 13:02:29 by cchauvet #+# #+# */
/* Updated: 2022/07/21 13:43:41 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
unsigned int ft_strlcat(char *dest, char *src, unsigned int size)
{
int i;
int j;
i = 0;
while (dest[i] != 0)
i++;
j = 0;
while (src[j] != 0 && i < size)
{
dest[i + j] = src[j];
j++;
}
dest[i + j] = '\0';
return (j);
}