std::fstream is an STL stream for file I/O.
#include <fstream> int main() { { //Create a new file (or remove its contents) std::ofstream f; f.open("my_file.txt"); f << "Hello"; } { //Append to file std::ofstream f; f.open("my_file.txt",std::ios::app); f << " world\n"; } }