/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncpy.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/14 21:18:44 by hulamy #+# #+# */ /* Updated: 2019/03/25 15:24:59 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ /* ** copy n characters from string src to dst including '\0' ** if space remain it's filled zith '\0', and return dst */ #include "libft.h" char *ft_strncpy(char *dest, const char *src, size_t n) { size_t i; i = -1; while (++i < n && src[i]) dest[i] = src[i]; while (i < n) dest[i++] = '\0'; return (dest); }