-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcpy.c
40 lines (36 loc) · 1.22 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
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sbin-jef <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/08 23:19:42 by sbin-jef #+# #+# */
/* Updated: 2024/05/10 00:58:42 by sbin-jef ### ########.fr */
/* */
/* ************************************************************************** */
unsigned int length(char *vtr)
{
unsigned int x;
x = 0;
while (vtr[x] != '\0')
{
x++;
}
return (x);
}
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size)
{
unsigned int og;
og = 0;
if (size != 0)
{
while ((src[og] != '\0') && (og < size - 1))
{
dest[og] = src[og];
og++;
}
dest[og] = '\0';
}
return (length(src));
}