How to append text to a text file in C++? Create new if does not exist and append if exist.
+8
A:
#include <iostream>
#include <fstream>
int main(void) {
std::ofstream outfile;
outfile.open("test.txt", std::ios_base::app);
outfile << "Data";
outfile.close();
return 0;
}
Bertrand Marron
2010-03-06 17:27:47
Thanks brother :)
Ahmad Farid
2010-03-06 17:32:27