get directory from file path c++

前端 未结 11 1427
梦如初夏
梦如初夏 2020-12-13 14:45

What is the simplest way to get the directory that a file is in? I\'m using this to find the working directory.

string filename = \"C:\\MyDirectory\\MyFile.b         


        
11条回答
  •  甜味超标
    2020-12-13 14:54

    You can use the _spliltpath function available in stdlib.h header. Please refer to this link for the same.

    http://msdn.microsoft.com/en-us/library/aa273364%28v=VS.60%29.aspx

提交回复
热议问题