当前位置: 技术问答>linux和unix
读文件问题
来源: 互联网 发布时间:2015-05-28
本文导语: UNIX下面有没有类似注册表读写的函数? 标准库的也行? 太穷了,没什么分 | /*-- Copyright (c) 2003 Shenzhen Surfilter Network Technology Co.Ltd File Name: config.h Version: 1.0 Abstract: declarations/definition...
UNIX下面有没有类似注册表读写的函数?
标准库的也行?
太穷了,没什么分
标准库的也行?
太穷了,没什么分
|
/*--
Copyright (c) 2003 Shenzhen Surfilter Network Technology Co.Ltd
File Name:
config.h
Version:
1.0
Abstract:
declarations/definitions for reading configuration file.
Author:
Gang He
Created on:
2003-12-23
Modified History:
Modified Person:
--*/
#ifndef _HEGANG_CONFIG_H_
#define _HEGANG_CONFIG_H_
#ifdef __cplusplus
extern "C" {
#endif
/* Set line length in configuration files */
#define LINE_LEN 128
/* Define return error code value */
#define ERR_NONE 0 /* read configuration file successfully */
#define ERR_NOFILE 2 /* not find or open configuration file */
#define ERR_READFILE 3 /* error occur in reading configuration file */
#define ERR_FORMAT 4 /* invalid format in configuration file */
#define ERR_NOTHING 5 /* not find section or key name in configuration file */
/*-
Name:
int getconfigstr(const char* section,
const char* keyname,
char* keyvalue,
unsigned int len,
const char* filename)
Description:
Read the value of key name in string form.
Input Parameters:
section: section name
keyname: key name
len: size of destination buffer
filename: configuration filename
Output Parameters:
keyvalue: destination buffer
Return Value:
0, otherwise positive number is returned if an error occurred.
-*/
int getconfigstr(const char* section,
const char* keyname,
char* keyvalue,
unsigned int len,
const char* filename);
/*-
Name:
int getconfigint(const char* section,
const char* keyname,
int* keyvalue,
const char* filename)
Description:
Read the value of key name in integer form.
Input Parameters:
section: section name
keyname: key name
filename: configuration filename
Output Parameters:
keyvalue: destination buffer
Return Value:
0, otherwise positive number is returned if an error occurred.
-*/
int getconfigint(const char* section,
const char* keyname,
int* keyvalue,
const char* filename);
#ifdef __cplusplus
}
#endif
#endif
Copyright (c) 2003 Shenzhen Surfilter Network Technology Co.Ltd
File Name:
config.h
Version:
1.0
Abstract:
declarations/definitions for reading configuration file.
Author:
Gang He
Created on:
2003-12-23
Modified History:
Modified Person:
--*/
#ifndef _HEGANG_CONFIG_H_
#define _HEGANG_CONFIG_H_
#ifdef __cplusplus
extern "C" {
#endif
/* Set line length in configuration files */
#define LINE_LEN 128
/* Define return error code value */
#define ERR_NONE 0 /* read configuration file successfully */
#define ERR_NOFILE 2 /* not find or open configuration file */
#define ERR_READFILE 3 /* error occur in reading configuration file */
#define ERR_FORMAT 4 /* invalid format in configuration file */
#define ERR_NOTHING 5 /* not find section or key name in configuration file */
/*-
Name:
int getconfigstr(const char* section,
const char* keyname,
char* keyvalue,
unsigned int len,
const char* filename)
Description:
Read the value of key name in string form.
Input Parameters:
section: section name
keyname: key name
len: size of destination buffer
filename: configuration filename
Output Parameters:
keyvalue: destination buffer
Return Value:
0, otherwise positive number is returned if an error occurred.
-*/
int getconfigstr(const char* section,
const char* keyname,
char* keyvalue,
unsigned int len,
const char* filename);
/*-
Name:
int getconfigint(const char* section,
const char* keyname,
int* keyvalue,
const char* filename)
Description:
Read the value of key name in integer form.
Input Parameters:
section: section name
keyname: key name
filename: configuration filename
Output Parameters:
keyvalue: destination buffer
Return Value:
0, otherwise positive number is returned if an error occurred.
-*/
int getconfigint(const char* section,
const char* keyname,
int* keyvalue,
const char* filename);
#ifdef __cplusplus
}
#endif
#endif