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