删除文件 - DeleteFile
函数简介
删除指定路径的文件。
接口名称
DeleteFile
DLL调用
int DeleteFile(long instance, string path);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| path | 字符串 | 要删除的文件完整路径。 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// 先创建文件,再删除
CreateFile(instance, "C:\\test\\temp.txt");
int ret = DeleteFile(instance, "C:\\test\\temp.txt");
// 验证文件已被删除
int exists = IsFile(instance, "C:\\test\\temp.txt"); // 返回0
Python
# 待补充
返回值
1 成功,0 失败。
注意事项
- 若文件正在被占用,可能删除失败。
