27 lines
1.1 KiB
C
27 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_memccpy.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/09/27 16:53:36 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/09/27 17:21:51 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
void *memccpy(void *dest, const void *src, int c, size_t n)
|
||
|
{
|
||
|
int *tab;
|
||
|
size_t max;
|
||
|
|
||
|
tab = (int *) src;
|
||
|
while (max < ft_strlen((char *) tab) && tab[max] == c)
|
||
|
max++;
|
||
|
if (max < n)
|
||
|
max = n;
|
||
|
return (ft_memcpy(dest, src, max));
|
||
|
}
|