'How is std::fstream with both in and out supposed to work?

I've just started wondering - how is actually std::fstream opened with both std::ios::in and std::ios::out actually supposed to work? What should it do? Write something to (for example) an empty file, then read... what? Just written value? Where would the file "pointer"/"cursor" be? Maybe the answer's already out there but I just couldn't have found it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source