#include <unistd.h>
#include <stdio.h>
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
{
unsigned int i = 0;
unsigned src_len = 0;
while(src[src_len] != '\0')
src_len++;
if(size == 0)
return src_len;
while(i < size-1 && src[i] != '\0')
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return src_len;
}
int main()
{
char str1[] = "hello world";
char str2[] = "HELLO";
int a = ft_strlcpy(str1, str2, 2);
printf("%d", a);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: