-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cfgfileHandler.cpp
More file actions
45 lines (23 loc) · 1.07 KB
/
test_cfgfileHandler.cpp
File metadata and controls
45 lines (23 loc) · 1.07 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
#include "cfgfileHandler.h"
int main(void) {
int i, nRecs, myInt, retStat;
char **fStruct;
char *myPtr;
double myDouble;
cfgfileHandler cfgFile;
retStat = cfgFile.cfgfileOpen((char *) "cfgFlexRadio.cfg");
if(retStat) {printf("File not found\n"); exit(99);}
nRecs = cfgFile.get_cfgfileNoRecs();
fStruct = cfgFile.get_cfgfileStructure();
if(fStruct == nullptr) {printf("null ptr returned\n"); exit(99);}
for( i = 0; i < nRecs; i++) {printf("%s\n", (fStruct)[i]);}
cfgFile.free_cfgfileStructure(&fStruct, nRecs);
retStat += cfgFile.getString_cfgfileParameter((char *) "band-4", 1, &myPtr) ;
printf("Band-4 parameter 1 as string, |%s|\n", myPtr);
retStat += cfgFile.getInt_cfgfileParameter((char *) "band-2", 1, &myInt) ;
printf("Band-2 parameter 1, as INT, |%d|\n", myInt);
retStat += cfgFile.getDouble_cfgfileParameter((char *) "band-1", 1, &myDouble) ;
printf("Band-1 parameter 1 as double, |%f|\n", myDouble);
if(retStat) {printf("Errors returned: %d\n", retStat);}
cfgFile.reset_cfgfileHandlerClass();
}