source: Daodan/src/inifile_test.c@ 606

Last change on this file since 606 was 451, checked in by rossy, 15 years ago

bsl thingy

File size: 746 bytes
RevLine 
[346]1#include <stdio.h>
2#include <stdbool.h>
[451]3#include <string.h>
[346]4#include "inifile.h"
5
6bool 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);
[451]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));
[346]17 return true;
18}
19
20int main()
21{
22 if (!inifile_read("testini.ini", ini_callback))
23 puts("Read error!");
24 return 0;
25}
Note: See TracBrowser for help on using the repository browser.