diff --git a/Makefile b/Makefile index ce18060..c9f22fb 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: kcolin +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2024/10/14 13:43:59 by kcolin #+# #+# # -# Updated: 2024/10/15 11:27:59 by kcolin ### ########.fr # +# Updated: 2024/10/15 13:37:50 by kcolin ### ########.fr # # # # **************************************************************************** # @@ -19,7 +19,8 @@ SOURCES = ft_isalpha.c \ ft_isprint.c \ ft_strlen.c \ ft_memset.c \ - ft_bzero.c + ft_bzero.c \ + ft_memcpy.c OBJECTS = $(SOURCES:.c=.o) CC = gcc diff --git a/ft_memcpy.c b/ft_memcpy.c new file mode 100644 index 0000000..bfbe02b --- /dev/null +++ b/ft_memcpy.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memcpy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: kcolin +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/10/15 13:38:05 by kcolin #+# #+# */ +/* Updated: 2024/10/15 13:42:29 by kcolin ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void *ft_memcpy(void *dst, const void *src, t_size len) +{ + t_size i; + + i = 0; + while (i < len) + { + ((char *)dst)[i] = ((char *)src)[i]; + i++; + } + return (dst); +} diff --git a/libft.h b/libft.h index f44ca2f..4e87f85 100644 --- a/libft.h +++ b/libft.h @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/15 10:11:54 by kcolin #+# #+# */ -/* Updated: 2024/10/15 11:30:58 by kcolin ### ########.fr */ +/* Updated: 2024/10/15 13:37:25 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,5 +25,6 @@ t_size ft_strlen(const char *s); void *ft_memset(void *dest, int c, t_size len); void ft_bzero(void *b, t_size len); +void *ft_memcpy(void *dst, const void *src, t_size len); #endif