我怎样判断路径strpath是文件还是目录

解决方案 »

  1.   

    CFile strpath ; 
    CFileStatus status;strpath.GetStatus( status ) ; 
    if(status & 0x10)
       AfxMessageBox("directory") ; 
    else
       AfxMessageBox("File") ;
      

  2.   

    enum Attribute {
       normal =    0x00,
       readOnly =  0x01,
       hidden =    0x02,
       system =    0x04,
       volume =    0x08,
       directory = 0x10,       //need Attribute 
       archive =   0x20
       };
      

  3.   

    CFileFind file;
    BOOL bContinue = file.FindFile(strPath);
    while(bContinue)
    {
    bContinue = file.FindNextFile();
    if(file.IsDirectory() && !file.IsDots())//是目录
        m_tree.InsertItem(file.GetFileName(),hParent);
             else
                          //不是目录
              }