-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
53 lines (46 loc) · 1.06 KB
/
main.c
File metadata and controls
53 lines (46 loc) · 1.06 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
52
53
/*
** EPITECH PROJECT, 2024
** B-CPE-110-LYN-1-1-settingup-aurelien.demeusy
** File description:
** main.c
*/
# include <fcntl.h>
# include <unistd.h>
# include <stdlib.h>
#include "include/my.h"
#include <stdio.h>
#include "include/struct.h"
#include <sys/stat.h>
int fichier_existe(const char *nom_fichier)
{
struct stat buffer;
return (stat(nom_fichier, &buffer) == 0);
}
int fichier_vide(const char *nom_fichier)
{
struct stat buffer;
if (stat(nom_fichier, &buffer) == -1) {
return 84;
}
return (buffer.st_size == 0);
}
int main(int argc, char **argv)
{
struct map m;
char **carte;
if (argc < 2)
return 84;
if (argc < 2)
return 84;
if (argc == 3){
m.lignes = str_to_int(argv[1]);
m.colonnes = str_to_int(argv[1]);
if (generate_map(m.lignes, argv) == NULL)
return 84;
m.carte = generate_map(m.lignes, argv);
}
lire_carte(argv[1], &m);
afficher_carte(m.carte, m.lignes, m.colonnes);
liberer_carte(m.carte, m.lignes);
return EXIT_SUCCESS;
}