Reputation: 13
I am making a C++ program that writes data to a file.
I am using MS Visual Studio Express 2012 for Windows Desktop,and my sources and .exe file are in different folders.
So,I need to create two files - one in sources folder and one in .exe-s folder.
But then,if I run my program using compiler,it will write data to the file in sources folder,and if I run .exe file,it will write to it's folder.
But I want all the data to be stored in the same file.
Sorry for bad explanation...
Please help!
Thanks.
Upvotes: 0
Views: 58
Reputation: 13003
You can change working directory in Project properties -> Debugging -> Working directory
. Set it to $(TargetDir)
(it's a macro for Output Directory
which can be set up at General
).
This way, when you starting program in VS, all relative paths will begin in binary's directory (instead of project directory, as it was with $(ProjectDir)
).
Upvotes: 2