I'm trying to figure out how to write and read data from files using:
#include<fstream>
I wrote a quick program to try to see about creating a file and writing to it, as well as tried a file already created and writing to it, but nothing seems to happen. ???
I've used:
ofstream outputFile;
outputFile.open("Input&Output_TestFileC++.txt"); //just an example...I've also tried using the pathway starting with the C drive....either way, nothing happens.
cout << "Test writing data to file";
outputFile << "Testing.";
outputFile.close();
cout << "Done testing writing data to file.";
The program will run fine, showing me the cout lines that were executed, but when I try to go to see if a file got created, and or using an existing file to see if the data got written to it...nothing has happened.
How is this fstream, ofstream, and ifstream supposed to be working exactly???
Is this happening because this is an IDE online environment so something else needs to be written in the code a specific way???