-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strncpy.c
More file actions
34 lines (31 loc) · 1.14 KB
/
ft_strncpy.c
File metadata and controls
34 lines (31 loc) · 1.14 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
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nhennigh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/11 15:23:48 by nhennigh #+# #+# */
/* Updated: 2019/02/14 13:51:50 by nhennigh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncpy(char *dst, const char *src, size_t len)
{
char *str_d;
char *str_s;
str_d = dst;
str_s = (char *)src;
while (len--)
{
if (*str_s)
{
*str_d = *str_s;
str_s++;
}
else
*str_d = '\0';
str_d++;
}
return (dst);
}