skeletton untested project
This commit is contained in:
commit
6fc620e8f4
187 changed files with 6584 additions and 0 deletions
36
libft/ft_strlcpy.c
Executable file
36
libft/ft_strlcpy.c
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strlcpy.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/14 16:13:17 by thrieg #+# #+# */
|
||||
/* Updated: 2025/02/16 19:04:51 by thrieg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
size_t ft_strlcpy(char *dst, const char *src, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
i = 0;
|
||||
if (size == 0)
|
||||
return (ft_strlen(src));
|
||||
while ((*src != '\0') && (i < size - 1))
|
||||
{
|
||||
*dst = *src;
|
||||
i++;
|
||||
dst++;
|
||||
src++;
|
||||
}
|
||||
while (*src != '\0')
|
||||
{
|
||||
i++;
|
||||
src++;
|
||||
}
|
||||
*dst = '\0';
|
||||
return (i);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue