-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strncpy.c
25 lines (22 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thakala <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/04 16:37:45 by thakala #+# #+# */
/* Updated: 2021/11/23 15:02:55 by thakala ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
char *ft_strncpy(char *dst, const char *src, size_t len)
{
char *new_beginning;
new_beginning = dst;
while (len-- && *src)
*dst++ = *src++;
while (len-- + 1)
*dst++ = '\0';
return (new_beginning);
}