posts - 131, comments - 12, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理
//创建文件夹
CString strFolderPath="c:\\deletetest.sql" ;
// 判断路径是否存在 
if (!PathIsDirectory(strFolderPath) ) 
CString strMsg; 
strMsg.Format ("指定路径\"%s\"不存在,是否创建?",strFolderPath); 
if (AfxMessageBox(strMsg, MB_YESNO) == IDYES) 
if (!CreateDirectory(strFolderPath, NULL ) ) 
strMsg.Format ("创建路径\"%s\"失败!是否继续?",strFolderPath); 
if (AfxMessageBox(strMsg, MB_YESNO) == IDYES) 
return; 
}
//创建并写入文件
/* fopen example */
#include <stdio.h>
int main ()
{
  FILE * pFile;
  pFile = fopen ("myfile.txt","w");
  if (pFile!=NULL)
  {
    fputs ("fopen example",pFile);
    fclose (pFile);
  }
  return 0;
}
//删除文件
1.
system( "del c:\\DBControlRun_deletefun.sql" );

2.
isError=(int)ShellExecute(dbControlrunDlg.hWnd,
NULL,
_T("cmd"),
_T("/K del c:\\DBControlRun_deletefun.sql"),
NULL, 
SW_HIDE);

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