Or... if you simply want to write to a FILE instead of to stdout,
Sort of like this:
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream log;
log.open("cpp.log", ios::app);
log << "Log entry here.\n";
log.close();
return 0;
}
So after executing the code above (named file_write):
...three times, I get the following content in the file cpp.log:
Code:
cat cpp.log
Log entry here.
Log entry here.
Log entry here.
But maybe that was too simple?
Best regards,
HMW
PS. Haven't used c++ in AGES. Please be gentle! DS.