File:  [ELWIX - Embedded LightWeight unIX -] / libaitcfg / example / test_av2.c
Revision 1.1.2.1: download - view: text, annotated - select for diffs - revision graph
Mon Jul 30 11:23:08 2012 UTC (11 years, 10 months ago) by misho
Branches: cfg5_3
added new feature cfgReadLines

    1: #include <stdio.h>
    2: #include <aitcfg.h>
    3: 
    4: 
    5: int
    6: main(int argc, char **argv)
    7: {
    8: 	cfg_root_t cfg;
    9: 	FILE *f;
   10: 
   11: 	if (cfgInitConfig(&cfg)) {
   12: 		printf("Error:: #%d - %s\n", cfg_GetErrno(), cfg_GetError());
   13: 		return 1;
   14: 	}
   15: 
   16: 	f = fopen("test_lines.txt", "r");
   17: 	if (!f) {
   18: 		cfgUnloadConfig(&cfg);
   19: 		return 2;
   20: 	} else {
   21: 		cfgReadLines(f, ":", "\r\n", &cfg);
   22: 		fclose(f);
   23: 	}
   24: 
   25: 	cfgWriteConfig(stdout, &cfg, 0);
   26: 	cfgUnloadConfig(&cfg);
   27: 	return 0;
   28: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>