-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strncpy.c
More file actions
23 lines (20 loc) · 1.06 KB
/
ft_strncpy.c
File metadata and controls
23 lines (20 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tyassine <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/26 00:59:06 by tyassine #+# #+# */
/* Updated: 2015/12/01 04:13:54 by tyassine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncpy(char *dst, const char *src, size_t n)
{
char *ret;
ret = dst;
while (n-- > 0)
*dst++ = (unsigned char)*src != '\0' ? *src++ : '\0';
return (ret);
}