This commit is contained in:
Camille Chauvet
2023-05-17 16:45:25 +00:00
commit 29ed24d567
619 changed files with 16119 additions and 0 deletions

View File

@ -0,0 +1,41 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thellego <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 09:44:45 by thellego #+# #+# */
/* Updated: 2022/07/20 11:02:34 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
{
unsigned int i;
i = 0;
while (i < size - 1 && src[i] != '\0')
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
while (src[i] != '\0')
{
i++;
}
return (i);
}
int main()
{
char tab1[12] = "hello world";
char tab[5] = "";
printf("%s\n", tab);
printf("%d\n", ft_strlcpy(tab, tab1, 11));
printf("%s\n", tab1);
printf("%s\n", tab);
}