I have a logging functionality and in this I have got log files. Now every time I run the program I want that previously written file should not get deleted and should be ap
Use something like:
#include #include using namespace std; int main() { ofstream out("try.txt", ios::app); out << "Hello, world!\n"; return 0; }
The ios:app option makes the output get appended to the end of the file instead of deleting its contents.