Files
HexPloR 60eef6cebe ew
2024-06-23 23:59:58 +02:00

44 lines
1.3 KiB
C
Executable File

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/09 17:27:30 by hexplor #+# #+# */
/* Updated: 2023/11/09 20:22:10 by hexplor ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dest, const char *src, size_t size)
{
size_t c;
size_t i;
c = 0;
while (src[c] != '\0')
c++;
i = 0;
if (size != 0)
{
while (src[i] != '\0' && i < (size - 1))
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
}
return (c);
}
/*int main()
{
char dest[10] = "oui";
char src[3] = "non";
ft_strlcpy(dest, src, 10);
return (0);
}*/