-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
32 lines (29 loc) · 1.17 KB
/
ft_strlcat.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
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sgrindhe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/08/03 20:33:50 by sgrindhe #+# #+# */
/* Updated: 2018/08/05 23:00:25 by sgrindhe ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t i;
size_t k;
i = 0;
k = 0;
while (dst[i] && i < size)
i++;
while ((src[k]) && ((i + k + 1) < size))
{
dst[i + k] = src[k];
k++;
}
if (i != size)
dst[i + k] = '\0';
return (i + ft_strlen(src));
}