How can I tell if a given path is a directory or a file? (C/C++)

后端 未结 7 1411
误落风尘
误落风尘 2020-12-08 13:22

I\'m using C and sometimes I have to handle paths like

  • C:\\Whatever
  • C:\\Whatever\\
  • C:\\Whatever\\Somefile

Is there a way to ch

相关标签:
7条回答
  • 2020-12-08 14:03

    If you're using CFile you can try

    CFileStatus status;
        if (CFile::GetStatus(fileName, status) && status.m_attribute == 0x10){
           //it's directory
    }
    
    0 讨论(0)
提交回复
热议问题