-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memccpy.c
More file actions
31 lines (28 loc) · 1.17 KB
/
ft_memccpy.c
File metadata and controls
31 lines (28 loc) · 1.17 KB
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: mtacnet <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/08 13:08:08 by mtacnet #+# #+# */
/* Updated: 2016/12/17 18:01:30 by mtacnet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dst, const void *src, int c, size_t n)
{
size_t i;
unsigned char *t1;
unsigned char *t2;
i = 0;
t1 = (unsigned char *)dst;
t2 = (unsigned char *)src;
while (i < n)
{
if ((*t1++ = *t2++) == (unsigned char)c)
return (t1);
i++;
}
return (NULL);
}