-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strncpy.c
32 lines (29 loc) · 1.1 KB
/
ft_strncpy.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
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lkuenane <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/06/02 16:48:55 by lkuenane #+# #+# */
/* Updated: 2017/06/08 08:24:08 by lkuenane ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncpy(char *dest, const char *src, size_t len)
{
int i;
i = 0;
while (len > 0 && src[i])
{
dest[i] = src[i];
i++;
len--;
}
while (len > 0)
{
dest[i++] = '\0';
len--;
}
return (dest);
}