summaryrefslogtreecommitdiff
path: root/libft/ft_strlcpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'libft/ft_strlcpy.c')
-rw-r--r--libft/ft_strlcpy.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libft/ft_strlcpy.c b/libft/ft_strlcpy.c
new file mode 100644
index 0000000..16016ae
--- /dev/null
+++ b/libft/ft_strlcpy.c
@@ -0,0 +1,28 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strlcpy.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2022/09/27 08:46:49 by kdx #+# #+# */
+/* Updated: 2022/10/14 02:25:35 by kdx ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+size_t ft_strlcpy(char *dst, const char *src, size_t size)
+{
+ size_t i;
+
+ i = 0;
+ while (i + 1 < size && src[i] != '\0')
+ {
+ dst[i] = src[i];
+ i += 1;
+ }
+ if (size)
+ dst[i] = '\0';
+ return (ft_strlen(src));
+}