-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strncat.c
27 lines (24 loc) · 1.14 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
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rodrodri <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/01 23:42:06 by rodrodri #+# #+# */
/* Updated: 2021/11/11 18:11:18 by rodrodri ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncat(char *s1, const char *s2, size_t n)
{
char *start;
size_t amount;
start = s1 + ft_strlen(s1);
amount = n;
if (n > ft_strlen(s2))
amount = ft_strlen(s2);
ft_memcpy(start, s2, amount);
ft_bzero(start + amount, 1);
return (s1);
}