I'm trying to learn about file i/o but I can't get this program to work.
For some reason, the entered string is not going into the file.Code:#include <fstream>
#include <iostream>
using namespace std;
int main()
{
char a_char;
ofstream a_file ( "log.txt" );
a_char = getchar();
cout << a_char;
a_file << a_char;
a_file << "This text will now be inside of log.txt";
a_file.close();
}
Any help is appreciated!