-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
41 lines (36 loc) · 1017 Bytes
/
test.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
#include "SODB.h"
struct TestStruct {
float x, y, z;
};
int main(){
SODBInit("test.dat", sizeof(struct TestStruct));
struct TestStruct ts = {1.2, 2.3, 3.4};
printf("%f", ts.x); printf(" ");
printf("%f", ts.y); printf(" ");
printf("%f", ts.z); printf(" ");
printf("\n");
printf("\n");
SODBAppend("test.dat", &ts);
ts.x = 5;
SODBAppend("test.dat", &ts);
ts.y = ts.z = 50;
SODBAppend("test.dat", &ts);
struct TestStruct nts;
SODBGet("test.dat", 0, &nts);
printf("%f", nts.x); printf(" ");
printf("%f", nts.y); printf(" ");
printf("%f", nts.z); printf(" ");
printf("\n");
SODBGet("test.dat", 1, &nts);
printf("%f", nts.x); printf(" ");
printf("%f", nts.y); printf(" ");
printf("%f", nts.z); printf(" ");
printf("\n");
SODBGet("test.dat", 2, &nts);
printf("%f", nts.x); printf(" ");
printf("%f", nts.y); printf(" ");
printf("%f", nts.z); printf(" ");
printf("\n");
system("pause");
return 0;
}