-
Notifications
You must be signed in to change notification settings - Fork 0
/
folder.c
executable file
·49 lines (45 loc) · 994 Bytes
/
folder.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
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
bool read_in_individual_file(char name[256])
{
char* line = NULL;
size_t len = 0;
long nread = 0;
FILE* nameoffile = NULL;
char* path = name;////////
if (!path)
return false;
nameoffile = fopen_s(1, path, "r");
if (nameoffile == NULL) {
free(path);
return false;
}
free(path);
return true;
}
//open a folder
bool read_folder(char *file)
{
DIR* my_dir = opendir("pokecfg/");
struct dirent* info;
if (!my_dir) {
return false;
}
do {
info = readdir(my_dir);
if (!info) {
return true;
}
if (read_in_individual_file("lol\n") == false) {
return false;
}
} while (info != NULL);
}