-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcpy.c
31 lines (28 loc) · 1.14 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: younhwan <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/05 00:28:36 by younhwan #+# #+# */
/* Updated: 2022/07/06 00:11:27 by younhwan ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dest, const char *src, size_t sz_)
{
size_t src_len;
size_t i;
src_len = ft_strlen(src);
if (!sz_)
return (src_len);
i = 0;
while (src[i] && i < (sz_ - 1))
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return (src_len);
}