国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
判斷目錄是否存在
VC判斷路徑是否存在
 
方法一:
 
 
CFileFind m_FileFind;
CString m_sFilePath = "D:\\Program Files\\Adobe\\Adobe Flash CS3";
if(!m_FileFind.FindFile(m_sFilePath))  //路徑不存在則創(chuàng)建該路徑
{
      CreateDirectory(m_sFilePath,NULL);
}
方法二:
CString   strFilePath;
strFilePath   =   "E:\\圖像\\";
strFilePath   +=   m_ID;
if   (!SetCurrentDirectory(strFilePath))  
{
     CreateDirectory(strFilePath, NULL);
}
方法三:
FindFirstFile()/
#define _WIN32_WINNT 0x0400
#include "windows.h"
int
main(int argc, char *argv[])
{
  WIN32_FIND_DATA FindFileData;
  HANDLE hFind;
  printf ("Target file is %s.\n", argv[1]);
  hFind = FindFirstFile(argv[1], &FindFileData);
  if (hFind == INVALID_HANDLE_VALUE) {
    printf ("Invalid File Handle. Get Last Error reports %d\n", GetLastError ());
  } else {
    printf ("The first file found is %s\n", FindFileData.cFileName);
    FindClose(hFind);
  }
  return (0);
}
方法四:
FILE *fp = fopen(strPath, "r")
if(fp == NULL)
{
//沒有同名文件
}
方法五:
 
  CString   strPath;  
  strPath   =   "c:\\abc.dat"  
  if(GetFileAttributes(strPath)   ==   0xFFFFFFFF)  
  {  
  AfxMessageBox("文件不存在");  
  return;  
  }  
。。。。。。。。。。
程序如下:  
  CString   filePath   =   "C:\\abc\\";  
  DWORD   dwAttr   =   GetFileAttributes(filePath);  
  if(dwAttr==-1||(dwAttr&FILE_ATTRIBUTE_DIRECTORY)==0)//目錄不存在  
  {  
  if   (   !CreateDirectory(filePath,   NULL)   )  
  {  
  AfxMessageBox("不能創(chuàng)建目錄");  
  return;  
  }  
  }  
方法六:
  WIN32_FIND_DATA   tFile;  
  memset(&tFile,   0,   sizeof(tFile));  
  CString   str   =   "d:\eeagadg\...";  
  if(FindFirstFile(str,   &tFile)   ==   INVALID_HANDLE_..)  
          不存在
 
方法七:
  int   _access(    
        const   char   *path,    
        int   mode    
  );  
。。。。。。。。
  #include   <io.h>  
  .....  
  char   szPathName[MAX_PATH]   =   "C:\\ABC";  
  if(_access(szPathName,0)   ==   0)  
        MessageBox(NULL,"該文件夾已經(jīng)存在","提示",0)  
  else  
    CreateDirectory(szPathName,NULL);
——————————————————————————————————————
——————————————————————————————————————
我在MFC程序中 用的是方法一:
 CString file;
 CFileFind fileFind;
 file=_T("D:\\T1\\T2");
   if (!fileFind.FindFile(file))
   {
   CreateDirectory(file,NULL);
   }
因?yàn)橛闷渌椒〞r(shí),可能要加額外的頭文件 所以選擇了這一個(gè)
參考資料:
 
本文來自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/shuilan0066/archive/2009/10/26/4728298.aspx
本文來自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/shuilan0066/archive/2009/10/26/4728298.aspx
本文來自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/shuilan0066/archive/2009/10/26/4728298.aspx
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
[轉(zhuǎn)載]VC中判斷目錄,文件是否存在,創(chuàng)建目錄,求目錄或
VC文件目錄常見操作
判斷是否合法的windows目錄
ini文件讀寫
一個(gè)文件中讀取數(shù)據(jù)并顯示的程序
遍歷文件夾并建成目錄樹 - VC知識(shí)庫文章
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服