From d6e50007009baf751930aec184218b4ced7dda19 Mon Sep 17 00:00:00 2001 From: Christopher Uhlig Date: Mon, 5 Aug 2024 13:42:32 +0200 Subject: [PATCH] added strncpy in lib --- lib/libft/ft_strncpy.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/libft/ft_strncpy.c diff --git a/lib/libft/ft_strncpy.c b/lib/libft/ft_strncpy.c new file mode 100644 index 0000000..30a9d3d --- /dev/null +++ b/lib/libft/ft_strncpy.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strncpy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: chuhlig +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/08/05 13:41:47 by chuhlig #+# #+# */ +/* Updated: 2024/08/05 13:42:00 by chuhlig ### ########.fr */ +/* */ +/* ************************************************************************** */ + +char *ft_strncpy(char *s1, char *s2, int n) +{ + int i; + + i = -1; + while (++i < n && s2[i]) + s1[i] = s2[i]; + return (s1); +} \ No newline at end of file -- 2.47.2