42_libft/ft_strlcpy.c

30 lines
1.1 KiB
C
Raw Normal View History

2022-09-27 10:29:23 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/27 16:24:15 by cchauvet #+# #+# */
/* Updated: 2022/09/27 16:29:08 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *strlcpy(char *dst, const char *src, size_t size)
{
char *str;
size_t i;
i = 0;
str = (char *) src;
while (str[i + 1] && dst[i + 1] && i < size - 1)
{
dst[i] = src[i];
i++;
}
dst[i] = 0;
return (dst);
}