I made a very simple C++ program that creates a .sav file with "Hey" written in it. The program works perfectly when I run it in Visual Studio 2019, but, after deploying my program on my computer, when I launch the deployed .exe file, it doesn't do anything.
I'm using Visual Studio 2019 on Windows 10. My program and my Setup file are both set in release and in x86 mode, my program is set to be statically linked(I changed my program's Runtime Library to Multi-threaded(/MT)). I deployed my project by following this article's instructions: https: //learn.microsoft.com/en-us/cpp/ide/walkthrough-deploying-your-program-cpp?view=vs-2019
After building the setup file, and launching the .msi installer created, the program installed does not even create the .sav file once launched.
Here's my code:
#include <fstream>
int main()
{
std::ofstream Yes;
Yes.open("Sc.sav");
Yes << "Hey" << std::endl;
Yes.close();
return 0;
}
What am I doing wrong?
Thanks in advance.
So, I found out what it was thanks to your comments: my application needed administrator rights to create the file, so I had to either ask the user for administrator rights, or save my file where I didn't need to have these rights.
I chose the second solution and saved my file in the C:\AppData\Roaming directory, where programs can save their files without asking the permission.
Thanks again for your help and attention.