I tried to use ofstream to write data to a .txt file in OMNET++ as follows with iostream and fstream included:
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
But OMNET++ is not resolving open and close functions.
Can someone suggest any way other than ofstream to achieve the same task of reading and writing data to .txt files in C++?
Turning my comment into an answer.
ofstream(and all other Standard Library classes) are defined in namespacestd. You need to use qualified names (such asstd::ofstream) to access them.