| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /************************************************************************
- * AUTHOR: NiuJiuRu
- * FILENAME: swfile.h
- * CONTENT: 常用的文件操作接口函数
- * NOTE:
- * HISTORY:
- * 1, [2010-08-19] created by NiuJiuRu
- * 2, [2014-01-10] 整体优化修改
- * 3, [2014-01-22] 整体优化修改
- ************************************************************************/
- #ifndef __SWFILE_H__
- #define __SWFILE_H__
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- /* 装载文件 */
- int sw_file_load(const char *filename, const char *mode, char *buf, int bufSize);
- /* 更新文件 */
- int sw_file_update(const char *filename, const char *mode, const char *buf, int bufSize);
-
- /* 得到文件大小 */
- int sw_file_getSize(const char *filename);
- /* 重命名文件 */
- int sw_file_rename(const char *oldName, const char *newName);
- /* 拷贝文件 */
- int sw_file_copy(const char *existingFilename, const char *newFilename, bool failIfExists);
- /* 删除文件 */
- int sw_file_delete(const char *filename);
- /* 判断文件是否存在 */
- bool sw_file_exists(const char *filename);
- /* 读配置或字典文件(mode : "GetFieldName", 根据"字段值"获取"字段名"; "GetFieldValue", 根据"字段名"获取"字段值") */
- char *sw_file_getCfgString(const char *filename, const char *section, const char *mode, char *field, char *value, int resultBufSize);
- /* 写配置或字典文件(mode : "SetFieldName", 根据"字段值"设置"字段名"; "SetFieldValue", 根据"字段名"设置"字段值") */
- bool sw_file_setCfgString(const char *filename, const char *section, const char *mode, const char *field, const char *value, bool autoAdd);
- /* 从配置或字典文件中删除(mode : "DelFieldByName", 根据"字段名"删除该"字段"; "DelFieldByValue", 根据"字段值"删除该"字段") */
- bool sw_file_delCfgString(const char *filename, const char *section, const char *mode, const char *field, const char *value);
- #ifdef __cplusplus
- }
- #endif
- #endif /* __SWFILE_H__ */
|