Alright so I am trying to swap fstreams. I do not use c++11 so there is no swap function. Is there anyway I can swap the files 2 fstreams have open? Or is there a way to get the name of the file that the fstream has open?
kyle.mace.35 0 Light Poster
Recommended Answers
Jump to PostAnd in all reality I will be working with more than two files because I am working on an external polyphase sort
Okay, you're making it too complicated. You'll already have a collection of stream objects for a polyphase sort, so just mark the index of (or have …
Jump to PostIf you cannot use the C++11 swap functions, your best bet is probably to use the filebufs directly and construct vanilla
istream
/ostream
objects from them. Something like this:class my_ofstream : public std::ostream { private: std::string filename; std::filebuf* pfb; public: my_ofstream(const std::string& aFilename) …
All 6 Replies
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
kyle.mace.35 0 Light Poster
kyle.mace.35 0 Light Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
kyle.mace.35 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.