Add files via upload
This commit is contained in:
+22
-2
@@ -10,7 +10,27 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
// 文件操作函数
|
||||
bool fileExists(const char* filename); // 检查文件是否存在
|
||||
bool createDirectory(const char* path); // 创建目录
|
||||
|
||||
/**
|
||||
* @brief 检查文件是否存在
|
||||
* @details 使用access函数(Unix/Linux)或_access函数(Windows)检查文件是否存在且可读
|
||||
* @param filename 要检查的文件路径
|
||||
* @return 如果文件存在且可读返回true,否则返回false
|
||||
* @note 函数只检查文件是否存在,不检查文件内容
|
||||
* @warning 如果filename为NULL,返回false
|
||||
*/
|
||||
bool fileExists(const char* filename);
|
||||
|
||||
/**
|
||||
* @brief 创建目录
|
||||
* @details 使用mkdir函数创建指定路径的目录
|
||||
* 在Windows下使用_mkdir,在Unix/Linux下使用mkdir
|
||||
* @param path 要创建的目录路径
|
||||
* @return 如果目录创建成功或已存在返回true,否则返回false
|
||||
* @note 如果目录已存在,函数返回true
|
||||
* @note 函数不会递归创建父目录
|
||||
* @warning 如果path为NULL,返回false
|
||||
*/
|
||||
bool createDirectory(const char* path);
|
||||
|
||||
#endif // FILE_UTILS_H
|
||||
Reference in New Issue
Block a user