-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.c
More file actions
51 lines (43 loc) · 1.32 KB
/
utils.c
File metadata and controls
51 lines (43 loc) · 1.32 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aboncine <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/22 16:07:03 by aboncine #+# #+# */
/* Updated: 2023/02/22 16:57:27 by aboncine ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void ft_print_error(char *str, char **strarr)
{
printf("%s", str);
ft_free_map(strarr);
exit(1);
}
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i])
i++;
return (i);
}
void ft_free_map(char **strarr)
{
int i;
i = 0;
while (strarr[i])
free(strarr[i++]);
free(strarr);
}
void ft_perror_exit(char *str)
{
perror(str);
exit (1);
}
double ft_degrees_to_radiants(double degrees)
{
return (degrees * PI / 180);
}