-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimer.c
50 lines (32 loc) · 893 Bytes
/
timer.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
#include "timer.h"
int main(int argc, char **argv) {
char zero = 1;
ROUTE r;
FILE *f = fopen("test.dat", "wb");
if (f == NULL) { // if file not found, tell them
printf("Error opening f\nClosing program.\n");
return; // and quit
}
fwrite(&zero, sizeof(zero), 1, f);
fclose(f);
read_splits(&r, "test.dat");
return 0;
}
void write_splits(ROUTE *route, char *filename) {
}
void read_splits(ROUTE *route, char *filename) {
char input;
int i;
FILE *f = fopen(filename, "rb+");
if (f == NULL) { // if file not found, tell them
printf("Error opening %s\nClosing program.\n", filename);
return; // and quit
}
fread(&input, 1, 1, f);
route -> num_splits = input;
printf("num_splits is %d\n", route -> num_splits);
for (i = 0; i < route -> num_splits; i++) {
fread(&(route -> splits[i]), sizeof(SPLIT), 1, f);
// printf("readddinnng!!!\n");
}
}