// using ofstream constructors. #include <iostream> #include <fstream> std::ofstream outfile ("test.txt"); outfile << "my text here!" << std::endl; outfile.close();