判断文件或目录是否存在 - FileOrDirectoryExists
函数简介
判断指定路径的文件或目录是否存在。
接口名称
FileOrDirectoryExists
DLL调用
int FileOrDirectoryExists(long instance, string path);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| path | 字符串 | 要判断的文件或目录路径。 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// 判断文件或目录是否存在
int exists = FileOrDirectoryExists(instance, "C:\\test\\hello.txt");
if (!exists) {
CreateFile(instance, "C:\\test\\hello.txt");
}
Python
# 待补充
返回值
1 存在,0 不存在或失败。
注意事项
- 路径无效或没有访问权限时返回0。
