]> git.dkaiser.de - 42/minishell.git/commitdiff
added strncpy in lib
authorChristopher Uhlig <chuhlig@2-D-4.42heilbronn.de>
Mon, 5 Aug 2024 11:42:32 +0000 (13:42 +0200)
committerChristopher Uhlig <chuhlig@2-D-4.42heilbronn.de>
Mon, 5 Aug 2024 11:42:32 +0000 (13:42 +0200)
lib/libft/ft_strncpy.c [new file with mode: 0644]

diff --git a/lib/libft/ft_strncpy.c b/lib/libft/ft_strncpy.c
new file mode 100644 (file)
index 0000000..30a9d3d
--- /dev/null
@@ -0,0 +1,21 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   ft_strncpy.c                                       :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: chuhlig <chuhlig@student.42.fr>            +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   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