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