std::basic_streambuf<CharT,Traits>::sgetc
提供: cppreference.com
<tbody>
</tbody>
int_type sgetc(); |
||
入力シーケンスから1文字読み込みます。
入力シーケンスの読み込み位置が利用可能でなければ underflow() を返します。 そうでなければ Traits::to_int_type(*gptr()) を返します。
引数
(なし)
戻り値
get ポインタの指す文字の値。
例
Run this code
#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'
関連項目
| 入力シーケンスから文字をひとつ読み込み、シーケンスを進めます (パブリックメンバ関数) | |
| 入力シーケンスを進めて、その後、進めずに文字をひとつ読み込みます (パブリックメンバ関数) |