亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        C++技巧(判斷目錄是否存在并創(chuàng)建目錄)

        字號(hào):

        判斷目錄是否存在并創(chuàng)建目錄:
            // Test Whether the dir exist
            CString m_dir;
            if (m_dir.Right(1) == “\\”)
            m_dir = m_dir.Left(m_dir.GetLength()-1);
            if (GetFileAttributes(m_dir) == FILE_ATTRIBUTE_DIRECTORY)
            return TURE;
            else
            CreateAllDirectory(m_dir);  
            // Function CreateAllDirectory
            // recursive function
            void CreateAllDirectory(CString Dir)
            {
            if (Dir.Right(1) == “\\”)
            Dir = Dir.Left(Dir.GetLength()-1);
            if (GetFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
            return;
            else if (GetFileAttributes(Dir) != -1)
            {
            if (DeleteFile(Dir)) // delete the file with the same name
            if (CreateDirectory(Dir, NULL))
            return;
            MessageBox(_T(“Can not create directory for captured pictures”), NULL, MB_OK);
            }
            int n = Dir.ReverseFind(‘\\’);
            CreateAllDirectory(Dir.Left(n));
            if (!CreateDirectory(Dir, NULL))
            MessageBox(_T(“Can not create directory for captured pictures”), NULL, MB_OK);
            }
            考試大提示判斷Dir中某個(gè)文件是否存在,還可以通過FileFind來實(shí)現(xiàn):
            BOOL FileExist(CString strFileName)
            {
            CFileFind fFind;
            return fFind.FindFile(strFileName);
            }