⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ini_manage.h

📁 一个类似于WIndows API中INI文件读写的源码
💻 H
字号:
/********************************************************************
	created:	2005/10/17											
	created:	17:10:2005   18:20									
	filename: 	ini_manage.h											
	file path:	..\INIManipulate											
	file base:	ini_manage											
	file ext:	h													
	author:		Chanchai Jaiyutitam									
																				
	purpose:	Header for manipulate ini file					

	updated:	2005/10/19
	updated by: Chanchai
*********************************************************************/

#ifndef INI_MANAGE_H
#define INI_MANAGE_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define COMMENT		'#'
#define INI_ERROR	-1

#ifndef CPP
typedef enum 
{
	true = 1,
	false = 0
}bool;
#endif

/************************************************************************/
/* type def                                                             */
/************************************************************************/
typedef enum
{
	REPLACE = 1,
	NON_REPLACE = 0
}REPLACE_FLAG;

/************************************************************************/
/* for record of ini content                                            */
/************************************************************************/
struct record
{
	char comments[255];
	char key[255];
	char value[255];
	struct record *next;
};

/************************************************************************/
/* for content of file                                                  */
/************************************************************************/
struct section
{
	struct record *data_first;
	struct record *data_last;
	unsigned int data_size;
	char comments[255];
	char name[255];
	struct section *next;
};
/************************************************************************/
/* for content list                                                     */
/************************************************************************/
typedef struct
{
	unsigned int section_size;
	struct section *first;
	struct section *last;
}content;

// global variable [10/18/2005]
content *ini_content;
char gfilename[255];
char *error_msg;
REPLACE_FLAG w_flag;

/************************************************************************/
/* main ini manage function                                             */
/************************************************************************/
/**
 *	function: ini_start														
 *	parameter:														
 *		@filename															
 *	return:	true if success														
 *	purpose: for start ini manipulate file														
 */
bool ini_start(const char* filename);

/**
 *	function:	load													
 *	parameter:														
 *		@filename															
 *	return:		true if success													
 *	purpose:	for load ini file to content													
 */

bool load(const char *filename);

/**
 *	function:	_save													
 *	parameter:														
 *		@filename															
 *	return:		true if success													
 *	purpose:	save content to ini file(save as)													
 */
bool save();	// save to load filebool 
bool save_as(const char *filename);

/**
 *	function:	get_value													
 *	parameter:														
 *		@															
 *	return:		value
 *	purpose:	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -