-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strncpy.c
34 lines (31 loc) · 1.13 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
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sbin-jef <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/08 00:31:13 by sbin-jef #+# #+# */
/* Updated: 2024/05/08 07:07:45 by sbin-jef ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
#include <unistd.h>
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
int i;
int j;
i = 0;
j = n;
while (i < j && src[i] != '\0')
{
dest[i] = src[i];
i++;
}
while (i < j)
{
dest[i] = '\0';
i++;
}
return (dest);
}