TEST15.C
资源名称:ertos.rar [点击查看]
上传用户:sunrenlu
上传日期:2022-06-13
资源大小:1419k
文件大小:1k
源码类别:
操作系统开发
开发平台:
DOS
- /*
- * Test15 - creates an INI file with three sections
- * - then reads an entry from the middle section
- * - finally demonstrates changing a value 5 times
- */
- #include <stdio.h>
- #include <string.h>
- #include <conio.h>
- #include <rtos.h>
- #include <inifile.h>
- main()
- {
- char *filename = "test15.ini";
- char *t;
- DWORD i, j;
- rt_init(100);
- cprintf("first we making sample config filern");
- /* make 3 sections, and we will later read from middle one */
- SetIniString( filename, "top","topic", "read failed, got top" );
- SetIniString( filename, "mid","topic", "read worked, got middle" );
- SetIniString( filename, "bottom","topic", "read failed, got botom" );
- /* throw in another string to confuse things */
- SetIniString( filename, "mid","topic2", "another key in mid" );
- t = GetIniString( filename, "mid", "topic", NULL );
- cprintf("Searching for mid, topic gets '%s'rn", t ? t : "<empty>");
- SetIniString( filename, "mid","topic", "write worked" );
- t = GetIniString( filename, "mid", "topic", "default" );
- cprintf("Searching for mid, topic gets '%s'rn", t ? t : "<empty>");
- for ( i = 0 ; i < 5 ; ++i ) {
- SetIniDWORD(filename, "mid", "count", i );
- j = GetIniDWORD(filename,"mid", "count", 0xffffffff );
- cprintf(" wrote %lu and read = %lurn", i, j );
- }
- }