ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/inifile_test.c
Revision: 451
Committed: Sun Jul 26 12:04:44 2009 UTC (16 years, 2 months ago) by rossy
Content type: text/x-csrc
File size: 746 byte(s)
Log Message:
bsl thingy

File Contents

# Content
1 #include <stdio.h>
2 #include <stdbool.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 }