-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strlcpy.c
More file actions
30 lines (27 loc) · 1.17 KB
/
ft_strlcpy.c
File metadata and controls
30 lines (27 loc) · 1.17 KB
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: joramire <joramire@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/26 18:01:16 by joramire #+# #+# */
/* Updated: 2022/09/27 09:37:25 by joramire ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, char *src, size_t dstsize)
{
size_t i;
i = 0;
while (src[i] != '\0' && i < (dstsize - 1) && dstsize != 0)
{
dst[i] = src[i];
i++;
}
if (dstsize != 0)
dst[i] = '\0';
if (ft_strlen(src) == 0)
return (0);
return ((size_t)ft_strlen(src));
}