| 1 |
#include <stdio.h> |
| 2 |
#include "bool.h" |
| 3 |
#include <string.h> |
| 4 |
#include "inifile.h" |
| 5 |
|
| 6 |
bool ini_callback(char* section, bool newsection, char* name, char* value) |
| 7 |
{ |
| 8 |
if (newsection) |
| 9 |
puts("New Section!"); |
| 10 |
printf("Section: %s Name: %s Value: %s\n", section, name, value); |
| 11 |
if (!_stricmp(name, "cleantest")) |
| 12 |
printf(" CleanTest: \"%s\" = \"%s\"\n", value, inifile_cleanstr(value)); |
| 13 |
if (!_stricmp(name, "inttest")) |
| 14 |
printf(" IntTest: %s = %u\n", value, (uint32_t)inifile_parseint(value, false)); |
| 15 |
if (!_stricmp(name, "sinttest")) |
| 16 |
printf(" IntTest: %s = %d\n", value, (int32_t)inifile_parseint(value, true)); |
| 17 |
return true; |
| 18 |
} |
| 19 |
|
| 20 |
int main() |
| 21 |
{ |
| 22 |
if (!inifile_read("testini.ini", ini_callback)) |
| 23 |
puts("Read error!"); |
| 24 |
return 0; |
| 25 |
} |