-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcpy.c
30 lines (27 loc) · 1.19 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: agarijo- <agarijo-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/28 13:50:16 by agarijo- #+# #+# */
/* Updated: 2022/09/30 11:12:16 by agarijo- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
unsigned int ft_strlcpy(char *dest, const char *src, unsigned int size)
{
unsigned int offset;
offset = 0;
if (size > 0)
{
while (*(src + offset) != '\0' && (offset != size - 1))
{
*(dest + offset) = *(src + offset);
offset++;
}
*(dest + offset) = '\0';
}
return (ft_strlen(src));
}