commit
This commit is contained in:
37
C_02/git_old/ex01/ft_strncpy.c
Normal file
37
C_02/git_old/ex01/ft_strncpy.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user