-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.c
66 lines (55 loc) · 1.46 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
55
56
57
58
59
60
61
62
63
64
65
66
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hbutt <hbutt@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/19 14:24:11 by hbutt #+# #+# */
/* Updated: 2024/07/08 16:17:17 by hbutt ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
int ft_strlen(const char *str)
{
int i;
i = 0;
while (str[i] != '\0')
i++;
return (i);
}
int ft_strlen_2(const char *str)
{
int i;
i = 0;
while (str[i] != '\0' && str[i] != '\n')
i++;
return (i);
}
char *ft_strcpy(char *dest, char *src)
{
int i;
i = 0;
while (src[i])
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return (dest);
}
void ft_message(char *msg)
{
int len;
len = ft_strlen(msg);
write(1, msg, len);
write(1, "\n", 1);
}
void ft_error(char *msg)
{
int len;
len = ft_strlen(msg);
write(1, msg, len);
write(1, "\n", 1);
exit(1);
}