You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.1 KiB
31 lines
1.1 KiB
3 years ago
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_strlcpy.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2021/10/18 16:08:31 by narnaud #+# #+# */
|
||
|
/* Updated: 2022/03/24 09:22:49 by narnaud ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "../libft.h"
|
||
|
|
||
|
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
|
||
|
{
|
||
|
size_t i;
|
||
|
|
||
|
i = 0;
|
||
|
while (dstsize && i < dstsize - 1 && src[i])
|
||
|
{
|
||
|
dst[i] = src[i];
|
||
|
i++;
|
||
|
}
|
||
|
if (dstsize)
|
||
|
dst[i] = '\0';
|
||
|
while (src[i])
|
||
|
i++;
|
||
|
return (i);
|
||
|
}
|