movefile失败,返回错误代码32

heliotrope77 2009-07-26 12:04:16
用movefile移文件夹
说是The process cannot access the file because it is being used by another process.
但是好像没别的东西在用这个文件夹或里面的文件啊
程序里会用到这个文件夹的也只有findfirstfile, findnextfile, creatdirectory,没有文件流
不明白是为什么。。。
...全文
2507 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
heliotrope77 2009-07-28
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 zhouzuoji 的回复:]
The MoveFile function will move (rename) either a file or a directory (including its children) either in the same directory or across directories. The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume.

MSDN说得很明白了,MoveFile不能在不同磁盘卷之间移动目录
[/Quote]

但我是在同一个盘下从一个文件夹里移到另一个文件夹里啊。。。
UndefinedCoder 2009-07-28
  • 打赏
  • 举报
回复
The MoveFile function will move (rename) either a file or a directory (including its children) either in the same directory or across directories. The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume.

MSDN说得很明白了,MoveFile不能在不同磁盘卷之间移动目录
heliotrope77 2009-07-26
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 oyljerry 的回复:]
FindFile后,记得FindClose关闭文件句柄,同时查看是否有别的程序使用..
[/Quote]

没有别的程序使用。。。最后一次试的时候我把所有相关的不相关的程序都退了,甚至那个文件夹都没打开,就留这一个跑。。。= =
heliotrope77 2009-07-26
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 steedhorse 的回复:]
对于文件夹来说,findfirstfile, findnextfile就算是使用了。
会不会你在find之后,忘记用FindClose来关闭FindFirstFile所打开的搜索句柄了?
[/Quote]

而且我在程序的其他地方,也有findfirstfile, findnextfile后,立马把找到的文件move到另一个地方去的,也顺利运行了呀。。。
heliotrope77 2009-07-26
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 steedhorse 的回复:]
对于文件夹来说,findfirstfile, findnextfile就算是使用了。
会不会你在find之后,忘记用FindClose来关闭FindFirstFile所打开的搜索句柄了?
[/Quote]

我在最后一次用findfirstfile, findnextfile的时候就关闭搜索句柄了。。。然后经过一次creatdirectory,才movefile。。。
oyljerry 2009-07-26
  • 打赏
  • 举报
回复
FindFile后,记得FindClose关闭文件句柄,同时查看是否有别的程序使用..
晨星 2009-07-26
  • 打赏
  • 举报
回复
对于文件夹来说,findfirstfile, findnextfile就算是使用了。
会不会你在find之后,忘记用FindClose来关闭FindFirstFile所打开的搜索句柄了?

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧