github to gitea
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strncpy.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lfirmin <[email protected]> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/12 03:38:21 by lfirmin #+# #+# */
|
||||
/* Updated: 2024/02/20 22:13:48 by lfirmin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void *ft_strncpy(char *dest, char *src, unsigned int n)
|
||||
{
|
||||
unsigned int curs;
|
||||
|
||||
curs = 0;
|
||||
while (curs < n && src[curs] != '\0')
|
||||
{
|
||||
dest[curs] = src[curs];
|
||||
curs++;
|
||||
}
|
||||
while (curs < n)
|
||||
{
|
||||
dest[curs] = '\0';
|
||||
curs++;
|
||||
}
|
||||
return (dest);
|
||||
}
|
||||
/*#include <stdio.h>
|
||||
int main(void)
|
||||
{
|
||||
char src[] = "Hello, World!";
|
||||
char dest[50];
|
||||
char n = 4;
|
||||
ft_strncpy(dest, src, n);
|
||||
printf("Source: %s\n", src);
|
||||
printf("Destination: %s\n", dest);
|
||||
}*/
|
||||
Reference in New Issue
Block a user