std::basic_...buf::xsgetn(3)

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

πŸ’… std::basic_...buf::xsgetn(3) πŸ’…

okay so welcome to the C++ Standard Libary page, bestie β€” yes that’s the manual name, and we’re talking about the std::basic_streambuf girlies today. πŸŽ€


✨ NAME ✨

The name line is literally std::basic_streambuf::sgetn,std::basic_streambuf::xsgetn β€” dash β€” and then it says it again: std::basic_streambuf::sgetn,std::basic_streambuf::xsgetn. No cap, it’s just built like that. πŸ’…


🌸 Synopsis 🌸

std::streamsize sgetn( char_type* s, std::streamsize count );

(1)

protected:
virtual std::streamsize xsgetn( char_type* s, std::streamsize count
);

(2)

  1. Calls xsgetn(s, count) of the most derived class.
  2. Reads count characters from the input sequence and stores them into a character array pointed to by s. The characters are read as if by repeated calls to sbumpc(). That is, if less than count characters are immediately available, the function calls uflow() to provide more until Traits::eof() is returned. Classes derived from std::basic_streambuf are permitted to provide more efficient implementations of this function.

🧸 Parameters 🧸

  • s β€” pointer to the beginning of a char_type array
  • count β€” maximum number of characters to read.

πŸ’– Return value πŸ’–

The number of characters successfully read. If it is less than count the input sequence has reached the end.


🧠 Notes 🧠

The rule about β€œmore efficient implementations” permits bulk I/O without intermediate buffering: that’s how std::ifstream::read simply passes the pointer to the POSIX read() system call in some implementations of iostreams.


🌈 Example 🌈

This section is incomplete Reason: no example

πŸ‘€ See also πŸ‘€

  • sputn invokes xsputn() (public member function)

🏷️ Category 🏷️

  • Todo no example

xoxo, your Unix-literate bestie πŸ’– β€” source: http://cppreference.com, version/date: 2024.06.10, page: std::basic_...buf::xsgetn(3). 🫢✨

πŸ“¦ where this page comes from