first commit
This commit is contained in:
30
ended/C02/ex10/ft_strlcpy.c
Normal file
30
ended/C02/ex10/ft_strlcpy.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strlcpy.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: ajoly <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/07/20 08:23:38 by ajoly #+# #+# */
|
||||
/* Updated: 2022/07/20 08:23:41 by ajoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i = 0;
|
||||
if (size > 0)
|
||||
{
|
||||
while (--size && src[i])
|
||||
{
|
||||
dest[i] = src[i];
|
||||
i++;
|
||||
}
|
||||
dest[i] = '\0';
|
||||
}
|
||||
while (src[i])
|
||||
i++;
|
||||
return (i);
|
||||
}
|
Reference in New Issue
Block a user