38 lines
1.2 KiB
C
38 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strncpy.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2021/08/09 18:19:08 by gbaconni #+# #+# */
|
|
/* Updated: 2021/08/11 18:05:56 by gbaconni ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
char *ft_strncpy(char *dest, char *src, unsigned int n)
|
|
{
|
|
unsigned int i;
|
|
unsigned int dest_size;
|
|
|
|
dest_size = 0;
|
|
while (dest[dest_size++] != '\0')
|
|
continue ;
|
|
i = 0;
|
|
while (n > 0 && i < n)
|
|
{
|
|
dest[i] = src[i];
|
|
i++;
|
|
}
|
|
while (i < dest_size)
|
|
{
|
|
printf("Hello\n");
|
|
dest[i] = '\0';
|
|
i++;
|
|
}
|
|
return (dest);
|
|
}
|