Open file by its full path in C++

前端 未结 5 2306
暖寄归人
暖寄归人 2021-02-18 21:24

I want the user to give me the full path where the file exists and not just the file name. How do I open the file this way?

Is it something like this:

if         


        
5条回答
  •  独厮守ぢ
    2021-02-18 22:18

    A different take on this question, which might help someone:

    I came here because I was debugging in Visual Studio on Windows, and I got confused about all this / vs \\ discussion (it really should not matter in most cases).

    For me, the problem was: the "current directory" was not set to what I wanted in Visual Studio. It defaults to the directory of the executable (depending on how you set up your project).

    Change it via: Right-click the solution -> Properties -> Working Directory

    I only mention it because the question seems Windows-centric, which generally also means VisualStudio-centric, which tells me this hint might be relevant (:

提交回复
热议问题