Namespaces
Variants
Actions

std::basic_filebuf<CharT,Traits>::sync

From cppreference.com
< cpp‎ | io‎ | basic filebuf
 
C++
 
Input/output library
 
std::basic_filebuf
protected:
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

[edit] See also

invokes sync()
(public member function of std::basic_streambuf<CharT,Traits>) [edit]
synchronizes an output stream with the actual file
(function) [edit]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant