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!

Related Questions

How to import util module in Node.js?

1  Asked on October 23, 2020 by lld


React.js search filtration on the array of objects

2  Asked on October 21, 2020 by ven-nilson


C# and the FileSystemWatcher

1  Asked on October 18, 2020 by thorsten-schroeer


C++ enum class with constructor

1  Asked on October 17, 2020 by cry0genic


Recharts ReferenceLine between data points

1  Asked on October 15, 2020 by philipp


Transform Issue With Bootstrap Card

3  Asked on October 15, 2020 by natalia-davydova


Ask a Question

Get help from others!

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