std::basic_streambuf<CharT,Traits>:: sgetc
From ja.cppreference.net
<
cpp
|
io
|
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文字を読み取る
(公開メンバ関数) |