std::basic_filebuf<CharT,Traits>::sync
From cppreference.com
< cpp | io | basic filebuf
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Input/output library
Print functions (C++23)
Buffers
(C++23)
(C++98/26*)
(C++20)
Streams
Abstractions
File I/O
String I/O
Array I/O
(C++23)
(C++23)
(C++23)
(C++98/26*)
(C++98/26*)
(C++98/26*)
Synchronized Output
(C++20)
Types
Error category interface
(C++11)
(C++11)
std::basic_filebuf
Public member functions
(C++11)
(C++11)
(C++26)
Protected member functions
basic_filebuf::sync
Non-member functions
(C++11)
protected:
virtual int sync()
virtual int sync()
If a put area exists (e.g. the file was opened for writing), calls overflow() to write all pending output to the file, then flushes the file as if by calling std::fflush .
If a get area exists (e.g. the file was opened for reading), the effect is implementation-defined. Typical implementation may empty out the get area and move the current file position back by the corresponding number of bytes.
Contents
[edit] Parameters
(none)
[edit] Return value
0 in case of success, -1 in case of failure.
[edit] Notes
sync()
or its equivalent is implicitly called for output streams by close()
, seekoff()
, and seekpos()
and explicitly called by std::basic_streambuf::pubsync()
[edit] Example
This section is incomplete
Reason: no example
Reason: no example