File: initest.cc

package info (click to toggle)
wvstreams 4.6.1-18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,420 kB
  • sloc: cpp: 64,196; ansic: 4,154; sh: 4,025; makefile: 546; perl: 402
file content (47 lines) | stat: -rw-r--r-- 985 bytes parent folder | download | duplicates (12)
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
46
47

/*
 * Worldvisions Weaver Software:
 *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
 *
 * The test program for the WvConfigFile class.  Not to be used in real life.
 *
 * Created:     Sept 12 1997            D. Coombs
 * Modified:    Sept 21 1997            D. Coombs
 * 
 */
#include <stdio.h>
#include "wvconf.h"

int main(int argc, char *argv[])
{
    WvConf cfg("testfile.ini");
    const char *test_str;

    if (!cfg.isok())
	return -1;

    if (argc != 3)
    {
	printf("Usage: %s section name\n", argv[0]);
	return -1;
    }

    test_str = cfg.get(argv[1], argv[2], "not there");
    printf("%d\n", cfg.getint("intl", "icountry", 5));
    printf("%s\n\n", test_str);
    if (!cfg.isok())
	return -1;

    cfg.set("Windows", "FooPort", "testywesty\n\n\n        \n");
    if (!cfg.isok())
	return -1;

    WvConfigSection *sect = cfg["fontsubSTitUtES"];
    if (sect)
	sect->dump(*wvcon);
    
    puts("");
    sect = cfg["should_not_exist"];

    return 0;
}