mirror of
https://github.com/Ladebeze66/libft.git
synced 2025-12-13 04:36:55 +01:00
32 lines
1.1 KiB
C
Executable File
32 lines
1.1 KiB
C
Executable File
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strncpy.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/11/27 20:03:19 by fgras-ca #+# #+# */
|
|
/* Updated: 2023/12/07 11:56:51 by fgras-ca ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
char *ft_strncpy(char *dest, char *src, unsigned int n)
|
|
{
|
|
unsigned int i;
|
|
|
|
i = 0;
|
|
while (src[i] != '\0' && i < n)
|
|
{
|
|
dest[i] = src[i];
|
|
++i;
|
|
}
|
|
while (i < n)
|
|
{
|
|
dest[i] = '\0';
|
|
i++;
|
|
}
|
|
return (dest);
|
|
}
|