-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.c
54 lines (47 loc) · 1.33 KB
/
utils.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amontign <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/06 11:29:35 by amontign #+# #+# */
/* Updated: 2023/07/24 08:38:34 by amontign ### ########.fr */
/* */
/* ************************************************************************** */
#include "utils.h"
size_t ft_strlen(const char *s)
{
size_t i;
i = 0;
while (s[i])
i++;
return (i);
}
size_t ft_strlcpy(char *dst, const char *src, size_t size)
{
unsigned int i;
unsigned int lg;
lg = ft_strlen(src);
i = 0;
if (size != 0)
{
while (src[i] != '\0' && i < size - 1)
{
dst[i] = src[i];
i++;
}
dst[i] = '\0';
}
return (lg);
}
void ft_putstr(char *s)
{
int i;
i = 0;
while (s[i])
{
write(1, &s[i], 1);
i++;
}
}