std::basic_streambuf<CharT,Traits>:: sgetc
From cppreference.net
<
cpp
|
io
|
basic streambuf
C++
Input/output library
| I/O manipulators | ||||
| Print functions (C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(C++20)
|
||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
| Synchronized Output | ||||
|
(C++20)
|
||||
| Types | ||||
| Error category interface | ||||
|
(C++11)
|
||||
|
(C++11)
|
std::basic_streambuf
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
int_type sgetc
(
)
;
|
||
입력 시퀀스에서 한 문자를 읽습니다.
입력 시퀀스 읽기 위치를 사용할 수 없는 경우 underflow() 를 반환합니다. 그렇지 않은 경우 Traits :: to_int_type ( * gptr ( ) ) 를 반환합니다.
목차 |
매개변수
(없음)
반환값
get pointer 가 가리키는 문자의 값입니다.
예제
이 코드 실행
#include <iostream> #include <sstream> int main() { std::stringstream stream("Hello, world"); std::cout << "sgetc() returned '" << (char)stream.rdbuf()->sgetc() << "'\n"; std::cout << "peek() returned '" << (char)stream.peek() << "'\n"; std::cout << "get() returned '" << (char)stream.get() << "'\n"; }
출력:
sgetc() returned 'H' peek() returned 'H' get() returned 'H'
참고 항목
|
(removed in C++17)
|
입력 시퀀스에서 한 문자를 읽고 시퀀스를 전진시킴
(public member function) |
|
입력 시퀀스를 전진시킨 후, 다시 전진하지 않고 한 문자를 읽음
(public member function) |