std::basic_...ambuf::sync(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

🌸 NAME 🌸

okay so this page is std::basic_streambuf::pubsync, std::basic_streambuf::sync β€” yes bestie, both of them, they're literally the same entry β€” straight out of the C++ Standard Libary manual (their spelling, not mine πŸ’…), section (3).


✨ Synopsis ✨

here's the vibe, look:

     int pubsync();      (1)
     protected:          (2)
     virtual int sync();

so what it does: it synchronizes the controlled character sequence (that's the buffers, bestie) with the associated character sequence. iconic behavior honestly.

  1. calls sync() of the most derived class 🫢
  2. the base class version of this function has no effect. derived classes may override this function to allow synchronizing the underlying device with the buffers.

for output streams, this typically results in writing the contents of the put area into the associated sequence, i.e. flushing of the output buffer πŸ”₯. for input streams, this typically empties the get area and forces a re-read from the associated sequence to pick up recent changes. the default behavior (found, for example, in std::basic_stringbuf) is to do nothing πŸ’€ like it literally sits there. main character energy of a function that does nothing.


πŸŽ€ Parameters πŸŽ€

  • (none) β€” not a single one. she takes zero arguments. unbothered. πŸ’…

πŸ’– Return value πŸ’–

  1. the return value of sync().
  2. returns 0 on success, -1 otherwise. the base class version returns 0.
so like, 0 = slay, -1 = not slay. keep that in mind fr fr.

πŸ¦‹ Example πŸ¦‹

  • This section is incomplete
  • Reason: no example

no example yet 😭 the cppreference girlies haven't finished it. we wait. 🧚


⭐ See also ⭐

  • sync β€” synchronizes with the underlying storage device (public member function of std::basic_istream<CharT,Traits>)
  • sync β€” writes characters to the associated file from the put area [virtual] (virtual protected member function of std::basic_filebuf<CharT,Traits>)

πŸ‘‘ Category πŸ‘‘

  • Todo no example

and that's the whole page bestie, no cap πŸ“

πŸŽ€ cute lil sign-off: this one came from http://cppreference.com and it's dated 2024.06.10 β€” so if anything's changed since, that's on them, not me πŸ’œβœ¨
πŸ“¦ where this page comes from