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