Namespaces
Variants

std::basic_streambuf<CharT,Traits>:: sputc

From cppreference.net
int_type sputc ( char_type ch ) ;

출력 시퀀스에 한 문자를 씁니다.

출력 시퀀스 쓰기 위치를 사용할 수 없는 경우(버퍼가 가득 찬 경우), overflow ( ch ) 를 호출합니다.

목차

매개변수

ch - 기록할 문자

반환값

기록된 문자는 성공 시 int_type 으로 변환되며, Traits :: to_int_type ( ch ) 를 사용합니다.

Traits :: eof ( ) (실패 시 overflow() 에 의해 반환됨)

예제

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

출력:

a

참고 항목

xsputn ( ) 를 호출합니다
(public member function)