inifile.h
来自「Unix/Linux下的INI文件读取、设置函数」· C头文件 代码 · 共 82 行
H
82 行
/******************************************************************************* * class for reading Ini File on Unix/Linux/Window*******************************************************************************/#ifndef __CINIFILE_H__#define __CINIFILE_H__//************************* begin of -- include ******************************#include <stdio.h> // for FILE//************************* **end of -- include ******************************//************************* begin of -- macro definitions ********************#define M_MAX_BUFFER_SIZE 6000#define M_MAX_VALUE_BUFFER_SIZE 512#define M_MAX_INTVAL_BUFFER_SIZE 32#define M_MAX_SECTION_SIZE 32//************************* **end of -- macro definitions ********************//************************* begin of -- type definitions *********************typedef struct { FILE* p_inifile; long i_filesize; char sz_filebuffer[M_MAX_BUFFER_SIZE]; int b_bufferchanged; // if TRUE, save file when close char sz_lastsection[M_MAX_SECTION_SIZE]; // previous section name int b_sectionfound; long i_sc_startpos; // start/end position of the long i_sc_endpos; // following lines of section long i_value_startpos; // start/end position of key long i_value_endpos; // value} IniFileData_TS;//************************* **end of -- type definitions *********************int IniInit( void );int IniOpenFile( const char * psz_file );int IniCloseFile( void );int IniGetString( const char * psz_section, const char * psz_key, char * psz_value );int IniSetString( const char * psz_section, const char * psz_key, const char * psz_value );int IniGetInteger( const char * psz_section, const char * psz_key, int i_default );int IniSetInteger( const char * psz_section, const char * psz_key, const int i_value );long IniGetLong( const char * psz_section, const char * psz_key, long i_default );int IniSetLong( const char * psz_section, const char * psz_key, const long i_value );double IniGetDouble( const char * psz_section, const char * psz_key, double i_default );int IniSetDouble( const char * psz_section, const char * psz_key, const double i_value );int IniGetBool( const char * psz_section, const char * psz_key, int b_default );int IniSetBool( const char * psz_section, const char * psz_key, const int b_value );int IniSearchSection( const char * psz_section );int IniSearchContentStart( const long i_startpos );int IniSearchContentEnd( const long i_startpos );#endif // __CINIFILE_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?