base struct
This commit is contained in:
28
lib/libft/srcs/str/ft_strlcpy.c
Normal file
28
lib/libft/srcs/str/ft_strlcpy.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strlcpy.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/12 10:07:49 by nalebrun #+# #+# */
|
||||
/* Updated: 2024/11/25 16:16:20 by nalebrun ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../libft.h"
|
||||
|
||||
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (!dst || !src)
|
||||
return (0);
|
||||
if (dstsize == 0)
|
||||
return (ft_strlen(src));
|
||||
i = -1;
|
||||
while (++i < dstsize - 1 && src[i])
|
||||
dst[i] = src[i];
|
||||
dst[i] = 0;
|
||||
return (ft_strlen(src));
|
||||
}
|
||||
Reference in New Issue
Block a user