SyntaxFix
Write A Post
Hire A Developer
Questions
You need to specify the append open mode like
#include <fstream> int main() { std::ofstream outfile; outfile.open("test.txt", std::ios_base::app); // append instead of overwrite outfile << "Data"; return 0; }