-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strncpy.c
More file actions
executable file
·27 lines (24 loc) · 1.1 KB
/
ft_strncpy.c
File metadata and controls
executable file
·27 lines (24 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nparker <nparker@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/27 13:31:16 by nparker #+# #+# */
/* Updated: 2018/12/05 17:29:25 by nparker ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncpy(char *dst, const char *src, size_t len)
{
size_t i;
i = -1;
while (++i < len)
if (*(src + i))
*(dst + i) = *(src + i);
else
while (i < len)
*(dst + i++) = '\0';
return (dst);
}