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
(
)
;
|
||
入力シーケンスから1文字を読み取ります。
入力シーケンスの読み取り位置が利用できない場合、 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)
|
入力シーケンスから1文字を読み取り、シーケンスを進める
(公開メンバ関数) |
|
入力シーケンスを進め、再度進めずに1文字を読み取る
(公開メンバ関数) |