-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcpy.c
27 lines (24 loc) · 1.11 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gaaraujo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/17 21:14:22 by gaaraujo #+# #+# */
/* Updated: 2024/11/20 22:17:51 by gaaraujo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
{
size_t src_len;
src_len = ft_strlen(src);
if (dstsize > 0)
{
while (*src && dstsize-- - 1)
*dst++ = *src++;
*dst = '\0';
}
return (src_len);
}