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