37 lines
1.2 KiB
C
37 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strlcpy.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/03/19 11:49:46 by tischmid #+# #+# */
|
|
/* Updated: 2023/03/21 00:48:06 by tischmid ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
|
|
{
|
|
unsigned int i;
|
|
|
|
i = -1;
|
|
while (*src && ++i < size - 1)
|
|
*dest++ = *src++;
|
|
*dest = 0;
|
|
return (i);
|
|
}
|
|
|
|
/* ////
|
|
#include <stdio.h>
|
|
|
|
int main(void)
|
|
{
|
|
char buf[BUFSIZ];
|
|
char str[] = {'A','B','C','D','E','\0'};
|
|
|
|
ft_strlcpy(buf, str, 5);
|
|
printf("%s\n", buf);
|
|
return (0);
|
|
}
|
|
*/ ////
|