Libft
42 Libft library documentation
Loading...
Searching...
No Matches
ft_strlcpy.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_strlcpy.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: raphalme <raphalme@student.42.fr> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/12/29 18:45:00 by raphalme #+# #+# */
9
/* Updated: 2026/04/14 10:45:22 by raphalme ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "../includes/libft.h"
14
23
size_t
ft_strlcpy
(
char
*dest,
const
char
*src,
size_t
size)
24
{
25
size_t
src_len;
26
size_t
i;
27
28
src_len =
ft_strlen
(src);
29
if
(size > 0)
30
{
31
i = 0;
32
while
(src[i] && i < (size - 1))
33
{
34
dest[i] = src[i];
35
i++;
36
}
37
dest[i] =
'\0'
;
38
}
39
return
(src_len);
40
}
ft_strlcpy
size_t ft_strlcpy(char *dest, const char *src, size_t size)
Copies a string into a bounded destination buffer.
Definition
ft_strlcpy.c:23
ft_strlen
size_t ft_strlen(const char *str)
Returns the length of a null-terminated string.
Definition
ft_strlen.c:21
src
ft_strlcpy.c
Generated by
1.9.8