Archived
1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
libft/ft_strlcpy.c

31 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/01 09:52:45 by adjoly #+# #+# */
/* Updated: 2023/11/03 22:46:49 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, const char *src, size_t size)
{
size_t i;
i = 0;
if (size == 0)
return (ft_strlen(src));
while (i < size - 1 && src[i])
{
dst[i] = src[i];
i++;
}
if (i < size)
dst[i] = '\0';
return (ft_strlen(src));
}