-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memccpy.c
24 lines (22 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mesafi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/30 21:58:26 by mesafi #+# #+# */
/* Updated: 2020/01/20 13:29:37 by mesafi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dest, const void *src, int c, size_t n)
{
while (n--)
{
*(unsigned char*)dest = *(unsigned char*)src;
if (dest++ && (*(unsigned char*)src++ == (unsigned char)c))
return (dest);
}
return (NULL);
}