use of fstream

I'm using fstream class for input and output both. But it shows errrored output when im using it for both input output though it working fine with only one operation..if there is any way to clear the buffer in between??
closed account (Dy7SLyTq)
i dont think so. its not generally recommended to do io on a file simultaneously. i would have two seperate ifstream/ofstream objects and make functions read and write that read bytes from the file and then write back to it, but when the function returns it closes the file
When you're referring to the action of clearing the buffer of an fstream, what exactly do you mean? Do you mean flushing it to the file, forcing a reread, or literally clearing the buffer of all its contents?

-Albatross
Topic archived. No new replies allowed.