mo 9a

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
434 B
1
Indexable
Never
#include <stdio.h>
#include <string.h>


size_t ft_strlcpy(char *dest, const char *src, size_t size)
{
    size_t ret = strlen(src);
    if (size)
    {
  	  size_t len = (ret >= size) ? size - 1 : ret;
   	 memcpy(dest, src, len);
   	 dest[len] = '\0';
    }
   	return ret;
    }

int main(void) {

	char test[] = "test";
	char test1[] = "sets";
	printf("%s\n", test);
	ft_strlcpy(test, test1, 4);
	printf("%s", test);
	return 0;
}