tgrekov-libft
HIVE libft Oct 2023
Loading...
Searching...
No Matches
ft_strlcpy.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_strlcpy.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2023/10/24 14:26:19 by tgrekov #+# #+# */
9
/* Updated: 2023/11/09 20:06:35 by tgrekov ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
20
#include "
libft.h
"
21
36
size_t
ft_strlcpy
(
char
*dst,
const
char
*src,
size_t
dstsize)
37
{
38
size_t
i;
39
40
i = 0;
41
while
(src[i] && (i + 1) < dstsize)
42
{
43
dst[i] = src[i];
44
i++;
45
}
46
if
(dstsize)
47
dst[i] =
'\0'
;
48
return
(
ft_strlen
(src));
49
}
ft_strlcpy
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
Copy at most dstsize - 1 characters from string src into dst.
Definition
ft_strlcpy.c:36
ft_strlen
size_t ft_strlen(const char *str)
Get length of str.
Definition
ft_strlen.c:28
libft.h
ft_strlcpy.c