/******************************************************************************** * * Copyright (C) 1999-2000 SCADA Technology Control Co., Ltd. All rights reserved. * * 读配置文件的调用接口函数 之 * 根据指定的 [段]及键的名称, 获取配置文件中的配置项 * * 创建日期: 2002/01/21 * * * * $Name: $ * * $Revision: 1.2 $ * * $Date: 2006/08/04 03:37:33 $ * * $State: Exp $ * * $Log: conf_read_key.cpp,v $ * Revision 1.2 2006/08/04 03:37:33 zhuzhenhua * no message * * Revision 1.1.2.1 2006/07/28 07:54:02 zhuzhenhua * no message * * Revision 1.2 2003/01/02 03:14:51 scada * trim substitution line * * Revision 1.1.1.1 2002/08/21 07:16:39 harold * temporarily import * * Revision 1.8 2002/03/20 03:40:22 harold * no message * * Revision 1.1.1.1 2002/03/15 13:43:21 harold * no message * * Revision 1.1.1.1 2002/03/15 08:17:11 harold * no message * * Revision 1.7 2002/01/23 06:07:22 harold * no message * * Revision 1.6 2002/01/23 05:43:55 harold * no message * * Revision 1.5 2002/01/23 05:41:06 harold * no message * * Revision 1.4 2002/01/23 03:35:41 harold * no message * * Revision 1.3 2002/01/23 03:34:24 harold * no message * * Revision 1.2 2002/01/23 03:26:24 harold * no message * * Revision 1.1 2002/01/21 02:46:53 harold * no message * * * ********************************************************************************/ //#include #include "confrw_errno.h" #include "confrw.h" #include "_confrw.h" #include "Profile_Hash.h" /* * 根据指定的 [段]及键的名称, 获取配置文件中的配置项 * * 参数 * handle -- 配置文件句柄 * pszsec_name -- 段名 * pszkey_name -- 键名称 * pszdefault -- 键的默认值, 以null字符结尾的字符串, * 如果配置文件中没有该键的配置, 同时, 该参数不为空, 则返回该值 * pbuf -- 返回值的缓冲区 * buffer_length -- 缓冲区长度 * * 返回值 * SUCCESS -- 成功的执行了本函数 * 其它 -- 失败代码 * */ int conf_read_key ( void * handle, const char * pszsec_name, const char * pszkey_name, const char * pszdefault, char * pbuf, int buffer_length ) { int len = buffer_length; return get_pgcprofile_string ( (char *)pszsec_name, (char *)pszkey_name, (char *)pszdefault, pbuf, (pgcu32 *)&len, (HPROFILE)*(int *)handle ); }