-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memccpy.c
More file actions
32 lines (29 loc) · 1.13 KB
/
ft_memccpy.c
File metadata and controls
32 lines (29 loc) · 1.13 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
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: eleclet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/25 17:09:30 by eleclet #+# #+# */
/* Updated: 2015/12/08 11:20:43 by eleclet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dst, const void *src, int c, size_t n)
{
char *s1;
char *s2;
size_t i;
i = 0;
s1 = (char *)dst;
s2 = (char *)src;
while (i < n)
{
s1[i] = s2[i];
if (s2[i] == c)
return (s1 + i + 1);
i++;
}
return (NULL);
}