aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Uhlig2024-08-05 13:42:32 +0200
committerChristopher Uhlig2024-08-05 13:42:32 +0200
commitd6e50007009baf751930aec184218b4ced7dda19 (patch)
treeef67a793d0fb32b70b9914a4d3e5ee3d16be5994
parent429730860776816050abd40a318de993c0c69e17 (diff)
downloadminishell-d6e50007009baf751930aec184218b4ced7dda19.tar.gz
minishell-d6e50007009baf751930aec184218b4ced7dda19.zip
added strncpy in lib
-rw-r--r--lib/libft/ft_strncpy.c21
1 files changed, 21 insertions, 0 deletions
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 <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