Projet de l'école 42 : Libft
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

3 years ago
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/18 16:08:31 by narnaud #+# #+# */
/* Updated: 2021/10/19 15:24:21 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
{
size_t i;
i = 0;
while (dstsize && i < dstsize - 1 && src[i])
{
dst[i] = src[i];
i++;
}
if (dstsize)
dst[i] = '\0';
while (src[i])
i++;
return (i);
}