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

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

🌸 NAME 🌸

std::basic_streambuf::sputc - std::basic_streambuf::sputc

okay so bestie, this one is from the C++ Standard Libary manual, and it's literally all about std::basic_streambuf::sputc πŸ’…


✨ Synopsis ✨

int_type sputc( char_type ch );

Writes one character to the output sequence.

If the output sequence write position is not available (the buffer is full), then it calls overflow(ch). 🫢

πŸŽ€ Parameters πŸŽ€

  • ch β€” character to write

πŸ’– Return value πŸ’–

  • The written character, converted to int_type with Traits::to_int_type(ch) on success.
  • Traits::eof() (as returned by overflow()) on failure.

πŸ¦‹ Example πŸ¦‹

// Run this code

#include <iostream>
#include <sstream>

int main()
{
    std::ostringstream s;
    s.rdbuf()->sputc('a');
    std::cout << s.str() << '\n';
}

🌈 Output 🌈

a

πŸ‘‘ See also πŸ‘‘

  • sputn invokes xsputn() (public member function)

mwah πŸ’‹ this cute little page is sourced from http://cppreference.com, version/date 2024.06.10, and the page itself is std::basic_...ambuf::sputc(3) ✨

πŸ“¦ where this page comes from