-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathft_strncat.c
26 lines (23 loc) · 1.1 KB
/
ft_strncat.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rlambert <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/03 19:29:46 by rlambert #+# #+# */
/* Updated: 2014/11/05 17:20:36 by rlambert ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncat(char *s1, const char *s2, size_t len)
{
char *s1iter;
s1iter = s1;
while (*s1iter != '\0')
s1iter++;
while (len-- > 0 && *s2 != '\0')
*s1iter++ = *s2++;
*s1iter = '\0';
return (s1);
}