-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcpy.c
32 lines (29 loc) · 1.15 KB
/
ft_strlcpy.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: johnavar <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/02 18:26:27 by johnavar #+# #+# */
/* Updated: 2024/02/11 18:07:53 by sebasnadu ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../include/libft.h"
size_t ft_strlcpy(char *dest, const char *src, size_t dstsize)
{
size_t i;
if (!src)
return (0);
i = 0;
while (src[i] && i < dstsize - 1)
{
dest[i] = src[i];
++i;
}
if (dstsize > 0)
dest[i] = '\0';
while (src[i])
++i;
return (i);
}