30 lines
1.1 KiB
C
30 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strlcpy.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/07/21 14:13:53 by cchauvet #+# #+# */
|
|
/* Updated: 2022/07/21 14:18:18 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
char *ft_strlcpy(char *dest, char *src, unsigned int n)
|
|
{
|
|
unsigned int i;
|
|
|
|
i = 0;
|
|
while (src[i] != '\0' && dest[i] != '\0' && i < n)
|
|
{
|
|
dest[i] = src[i];
|
|
i++;
|
|
}
|
|
while (i < n && dest[i] != '\0')
|
|
{
|
|
dest[i] = '\0';
|
|
i++;
|
|
}
|
|
return (i);
|
|
}
|