-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcpy.c
28 lines (25 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apimikov <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/31 11:49:39 by apimikov #+# #+# */
/* Updated: 2023/11/03 16:30:51 by apimikov ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
{
size_t i;
i = 0;
while (src[i])
i++;
if (dstsize == 0)
return (i);
while (--dstsize && *src)
*dst++ = *src++;
*dst = '\0';
return (i);
}