-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memccpy.c
31 lines (28 loc) · 1.17 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
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: igarbuz <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/12 10:57:46 by igarbuz #+# #+# */
/* Updated: 2018/11/19 18:09:31 by igarbuz ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dst, const void *src, int c,
size_t n)
{
unsigned char *mydst;
mydst = (unsigned char *)dst;
n++;
while (--n)
{
*mydst = *(unsigned char *)src;
if (*(unsigned char *)src == (unsigned char)c)
return (mydst + 1);
mydst++;
src++;
}
return (NULL);
}