libft/ft_memccpy.c
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jlasne <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 12:55:22 by jlasne #+# #+# */
/* Updated: 2016/11/03 12:55:26 by jlasne ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dst, const void *src, int c, size_t n)
{
size_t i;
unsigned char *d;
unsigned char *s;
d = (unsigned char *)dst;
s = (unsigned char *)src;
i = 0;
while (i < n)
{
d[i] = s[i];
if (d[i] == (unsigned char)c)
return (dst + (i + 1));
i++;
}
return (NULL);
}