-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcat.c
executable file
·35 lines (32 loc) · 1.21 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
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rlechapt <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/11 10:20:23 by rlechapt #+# #+# */
/* Updated: 2014/11/11 21:57:06 by rlechapt ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
int i;
int j;
int start;
i = 0;
j = 0;
while (dst[i] != '\0' && i < (int)size)
i++;
start = i;
while (src[j] != '\0' && i < (int)size - 1)
{
dst[i] = src[j];
i++;
j++;
}
if (i > start)
dst[i] = '\0';
return (start + ft_strlen((char*)src));
}