I have a C++ program that reads some text files from a subdirectory located in the source code folder. The problem is that, the path that I've written in the program is relative and vs code outputs the debug program in /tmp/ directory, which is then unable to read those files. Is there some way of working around it except for giving the absolute path of text files to the program?
-
1Configure the path where the debug program is created. This should be configurable in tasks.json and launch.json. Here is VSCode's page for configuring the debugger.mgonnav– mgonnav2020-09-01 18:06:36 +00:00Commented Sep 1, 2020 at 18:06
-
How will you find that file "in production"?Vlad Feinstein– Vlad Feinstein2020-09-01 18:22:06 +00:00Commented Sep 1, 2020 at 18:22
-
@Vlad Fernstein Why would I do debugging in production;)?Arpit Bhadauria– Arpit Bhadauria2020-09-01 18:26:51 +00:00Commented Sep 1, 2020 at 18:26
-
Change the CWD of your program when run from the IDE.Jesper Juhl– Jesper Juhl2020-09-01 18:30:32 +00:00Commented Sep 1, 2020 at 18:30
-
@ArpitBhadauria I am saying that you need a way to find your external file regardless of the "source code folder". Using that is not sensitive to the changes in the location of your executableVlad Feinstein– Vlad Feinstein2020-09-01 20:08:00 +00:00Commented Sep 1, 2020 at 20:08
Add a comment
|