移动文件 - MoveFile
函数简介
将源文件移动到目标路径,相当于剪切操作。
接口名称
MoveFile
DLL调用
int MoveFile(long instance, string src, string dst);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| src | 字符串 | 源文件完整路径。 |
| dst | 字符串 | 目标文件完整路径。 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// 创建文件后移动到新路径
CreateFile(instance, "C:\\test\\old.txt");
int ret = MoveFile(instance, "C:\\test\\old.txt", "C:\\test\\new\\old.txt");
// 原路径文件不再存在
int exists = IsFile(instance, "C:\\test\\old.txt"); // 返回0
Python
# 待补充
返回值
1 成功,0 失败。
注意事项
- 跨盘移动时可能表现为复制+删除,视底层实现而定。
