/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strnjoin.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bchanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/05/15 16:51:36 by bchanot #+# #+# */ /* Updated: 2018/10/29 12:20:46 by bchanot ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strnjoin(const char *s1, const char *s2, size_t n) { char *s; if (!s1 || !s2) return (NULL); if (!(s = ft_strnew(ft_strlen(s1) + n + 1))) return (NULL); s = ft_strcpy(s, (char *)s1); s = ft_strncat(s, (char *)s2, n); return (s); }