随笔 - 67  文章 - 171  trackbacks - 0
<2008年2月>
272829303112
3456789
10111213141516
17181920212223
2425262728291
2345678

常用链接

留言簿(10)

随笔分类

随笔档案

连接资料

最新随笔

搜索

  •  

最新随笔

最新评论

  extern   TCHAR*   pOldName;  
  extern   TCHAR*   pNewName;  
   
  try  
  {  
          CFile::Rename(   pOldName,   pNewName   );  
  }  
  catch(CFileException*   pEx   )  
  {  
  #ifdef   _DEBUG  
          afxDump   <<   "File   "   <<   pOldName   <<   "   not   found,   cause   =   "  
                          <<   e->m_cause   <<   "\n";  
  #endif  
          pEx->Delete();  
  }  
或者 MOVE FILE
posted on 2008-02-07 16:21 cpsprogramer 阅读(1728) 评论(2)  编辑 收藏 引用 所属分类: VC++

FeedBack:
# re: 文件重新命名 2008-02-21 10:11 canopus

extern char* pOldName;
extern char* pNewName;

SHFILEOPSTRUCT fileOp;
fileOp.hwnd = NULL;
fileOp.wfunc = FO_RENAME;
fileOp.pfrom = (LPCSTR)pOldName;
fileOp.pto = (LPCSTR)pNewName;
fileOp.fflags = FOF_RENAMEONCOLLISION;
fileOp.fanyoperationsaborted = false;
fileOp.hnamemappings = NULL;
fileOp.lpszprogresstitle = "";
SHFILEOPERATION(&fileOp);  回复  更多评论
  
# re: 文件重新命名 2008-02-27 19:50 yefhia
xiexie~!  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理