mirror of
https://github.com/Ladebeze66/Piscine42.git
synced 2025-12-16 05:58:07 +01:00
40 lines
1.2 KiB
C
Executable File
40 lines
1.2 KiB
C
Executable File
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strncat.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/12/10 16:23:52 by fgras-ca #+# #+# */
|
|
/* Updated: 2022/12/12 18:33:50 by fgras-ca ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_strlen(char *str)
|
|
{
|
|
int i;
|
|
|
|
i = 0;
|
|
while (str[i])
|
|
{
|
|
i++;
|
|
}
|
|
return (i);
|
|
}
|
|
|
|
char *ft_strncat(char *dest, char *src, unsigned int nb)
|
|
{
|
|
unsigned int i;
|
|
unsigned int dest_len;
|
|
|
|
i = 0;
|
|
dest_len = ft_strlen(dest);
|
|
while (src[i] && i < nb)
|
|
{
|
|
dest[dest_len + i] = src[i];
|
|
i++;
|
|
}
|
|
dest[dest_len + i] = '\0';
|
|
return (dest);
|
|
}
|