-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfill_csv_head.c
More file actions
43 lines (32 loc) · 913 Bytes
/
Copy pathfill_csv_head.c
File metadata and controls
43 lines (32 loc) · 913 Bytes
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
int main(int argc, char *argv[]) {
char* matrix_folder = "matrices";
DIR* fd;
FILE* results_csv;
struct dirent* in_file;
results_csv = fopen("results.csv","w");
/* Scanning the in directory */
if (NULL == (fd = opendir (matrix_folder)))
{
fprintf(stderr, "Error : Failed to open input directory - %s\n", strerror(errno));
return 1;
}
fprintf(results_csv, "product, format, threads");
while ((in_file = readdir(fd)))
{
if (!strcmp (in_file->d_name, "."))
continue;
if (!strcmp (in_file->d_name, ".."))
continue;
fprintf(results_csv, ", %s", in_file->d_name);
}
fprintf(results_csv, "\n");
fclose(results_csv);
closedir(fd);
}