-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memccpy.c
executable file
·27 lines (25 loc) · 1.12 KB
/
ft_memccpy.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achambon <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/25 13:41:29 by achambon #+# #+# */
/* Updated: 2016/12/02 11:00:10 by achambon ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
void *ft_memccpy(void *dst, const void *src, int c, size_t n)
{
while (n > 0)
{
*(char*)dst = *(const char*)src;
if (*(unsigned char*)src == (unsigned char)c)
return (dst + 1);
src++;
dst++;
n--;
}
return (NULL);
}