basic_streambuf::sputbackc

Char_type에 스트림이 배치 됩니다.

int_type sputbackc(
   char_type _Ch
);

매개 변수

  • _Ch
    문자입니다.

반환 값

오류를 반환합니다.

설명

Putback 위치를 사용할 수 있는 경우 및 _Ch 비교 같음 멤버 함수 감소 해당 위치에 저장 된 문자 입력된 버퍼 및 반환에 대 한 다음 포인터 traits_type::to_int_type(_Ch).그렇지 않으면, pbackfail(_Ch).

예제

// basic_streambuf_sputbackc.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>

int main( )
{
    using namespace std;

    ifstream myfile("basic_streambuf_sputbackc.txt",
        ios::in);

    int i = myfile.rdbuf()->sbumpc();
    cout << (char)i << endl;
    int j = myfile.rdbuf()->sputbackc('z');
    if (j == 'z')
    {
        cout << "it worked" << endl;
    }
    i = myfile.rdbuf()->sgetc();
    cout << (char)i << endl;
}

입력: basic_streambuf_sputbackc.txt

testing

k3h5b8cx.collapse_all(ko-kr,VS.110).gifOutput

t
it worked
z

요구 사항

헤더: <streambuf>

네임 스페이스: std

참고 항목

참조

basic_streambuf Class

iostream 프로그래밍

iostreams 규칙