Debugging C++ program that reads external files in visual studio code

Stack Overflow Asked by Arpit Bhadauria on November 10, 2020

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?

One Answer

You need to configure the working directory for Debugging in the Configuration Properties, So that you can access the file required using relative path.

In project properties window Configuration Properties -> Debugging -> Working Directory update this to the desired path.

Answered by Mohammed Masood Ahmed on November 10, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP