I am opening a file in main func using
ofstream atminit ("atminit.txt");
if (! atminit.is_open())
cout << "error opening atminit.txt, press any key to exit.....";
cout << "opened atminit file ok" << endl;
I want to write some information to the file from a different function. Is it possible to open the file globally? can I pass a pointer of the file to the function and write to the pointer? If so then how do I open it as a pointer and how do I write to it.