rt,thx

解决方案 »

  1.   

    int _chdir( const char *dirname );
      

  2.   

    bool gDirExist(CString csDir)
    {
    CFileFind cfd; if(csDir.IsEmpty())
    return false; csDir = csDir + "*";
    if( cfd.FindFile(csDir) )
    {
    cfd.FindNextFile();
    if(cfd.IsDirectory())
    return true;
    else
    return false;
    }
    else
    return false;
    }
      

  3.   

    CreateFile
    The CreateFile function creates or opens the following objects and returns a handle that can be used to access the object: Consoles 
    Communications resources 
    Directories (open only) 
    Disk devices 
    Files 
    Mailslots 
    Pipes 
    HANDLE CreateFile(
      LPCTSTR lpFileName,                         // file name
      DWORD dwDesiredAccess,                      // access mode
      DWORD dwShareMode,                          // share mode
      LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
      DWORD dwCreationDisposition,                // how to create
      DWORD dwFlagsAndAttributes,                 // file attributes
      HANDLE hTemplateFile                        // handle to template file
    );
      

  4.   

    SECURITY_ATTRIBUTES SA;SA.nLength = 200;
    SA.lpSecurityDescriptor = NULL;BOOL bRet = CreateDirectory((LPCTSTR)strYourPath,  &SA);
    DWORD dwError = GetLastError();
    if (dwError == ERROR_ALREADY_EXISTS)//目录已经存在
      ...;  
    else
      ...;
      

  5.   

    WIN32_FIND_DATA data;
    ZeroMemory(&data, sizeof(WIN32_FIND_DATA));if (FindFirstFile(lpFileName, &data) ==INVALID_HANDLE_VALUE)
        find ok;
    else
        {
         if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
             find ok;
         else
             find fail;
         }