The C++ Standard, [filebuf], paragraph 2 [ISO/IEC 14882-2014], states the following:
The restrictions on reading and writing a sequence controlled by an object of class
basic_filebuf<charT, traits>are the same as for reading and writing with the Standard C libraryFILEs.
...
No other std::basic_filebuf<T> function guarantees behavior as if a call were made to a standard C library file-positioning function, or std::fflush().
Note that calling Calling std::basic_ostream<T>::seekp() or std::basic_istream<T>::seekg() eventually results in a call to std::basic_filebuf<T>::seekoff() for file stream positioning. Given that std::basic_iostream<T> inherits from both std::basic_ostream<T> and std::basic_istream<T>, and std::fstream inherits from std::basic_iostream, either function is acceptable to call to ensure the file buffer is in a valid state before the subsequent IO I/O operation.
Noncompliant Code Example
...