I have a program that, multiple times throughout, uses fstream to save to files. It works perfectly when running in microsoft vs, but when I compile a release, and bring the .exe to my desktop, it won't write to any files there.
ofstream save;
save.open("Data\\options.scav");
/*Write stuff to file*/
This works fine in visual studio, but if I bring it to my desktop, and even create the Data folder for it, it doesn't write. Any help would be appreciated.
You cannot write to a path that has not already been created.
Do like this:
Note that for portability reasons you can also do this (on Windows or Unix):