void swap (ofstream& x);
*this
123456789101112131415
// swapping ofstream objects #include <fstream> // std::ofstream int main () { std::ofstream foo; std::ofstream bar ("test.txt"); foo.swap(bar); foo << "lorem ipsum"; foo.close(); return 0; }