42-archive/libftasm/srcs/mem/ft_memccpy.c
2017-03-31 18:40:30 +02:00

27 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:26 by jhalford #+# #+# */
/* Updated: 2017/03/06 15:36:13 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dst, const void *src, int c, size_t n)
{
size_t i;
i = -1;
while (++i < n)
{
*(char *)dst++ = *(char *)src;
if (*(char *)src++ == c)
return (dst);
}
return (NULL);
}