I'm trying to create a log file using the code below, but It's not working and I'm unable to get the logs as the file is not created!
#include <iostream>
#include <fstream>
using namespace std;
ofstream myfile;
int main () {
myfile.open ("example.txt");
if (!myfile.is_open())
{
cerr << "Failed to create Log" << endl;
}
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}