C++或CBC中文件的剪切函数是什么?

Shawn 2006-09-29 08:46:06
在一个目录中有一些文件:
1_a.tif
1_b.tif
1_c.tif
......
2_a.tif
2_b.tif
2_c.tif
......
......
怎样把它们剪切到本目录中的1,2 .....的文件夹内?就像系统的那样剪切(速度非常快),而不是先Copy再Paste(速度慢)
...全文
237 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lurel 2006-09-29
  • 打赏
  • 举报
回复
BOOL MoveFile(
LPCTSTR lpExistingFileName,
LPCTSTR lpNewFileName
);
BenLeak 2006-09-29
  • 打赏
  • 举报
回复
#include <shellapi.h>
void __fastcall TForm1::Button1Click(TObject *Sender)
{
SHFILEOPSTRUCT FileOp;
char fPath[256], tPath[256];

memset ( &FileOp, 0, sizeof(FileOp) );
memset ( fPath, 0, sizeof(fPath) );
memset ( tPath, 0, sizeof(tPath) );
FileOp.wFunc = FO_MOVE;
strcpy ( fPath, "F:\\RarFiles\\0ffice2000.rar" );
strcpy ( tPath, "F:\\Tools\\0ffice2000.rar" );
FileOp.pFrom = fPath;
FileOp.pTo = tPath;
if ( ! SHFileOperation ( &FileOp ) ) ShowMessage ( "success!" );
else ShowMessage ( "Failed!" );
}

13,826

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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