名前空間
変種
操作

std::basic_istream::peek

提供: cppreference.com
< cpp‎ | io‎ | basic istream

 
 
 
std::basic_istream
グローバルオブジェクト
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
書式付き入力
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
書式なし入力
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::peek
ポジショニング
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
メンバークラス
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
非メンバ関数
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
int_type peek();
UnformattedInputFunctionとして動作します。構築し、監視オブジェクトをテストした後、それを解凍せずに入力ストリームから次の文字を読み込みます.
Original:
Behaves as UnformattedInputFunction. After constructing and testing the sentry object, reads the next character from the input stream without extracting it.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

(なし)

[編集] 値を返します

good() == true場合rdbuf()->sgetc()によって得られたとして、次の文字を返します
Original:
If good() == true, returns the next character as obtained by rdbuf()->sgetc()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
それ以外の場合、返品Traits::eof().
Original:
Otherwise, returns Traits::eof().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#include <sstream>
#include <iostream>
int main()
{
    std::istringstream s1("Hello, world.");
    char c1 = s1.peek();
    char c2 = s1.get();
    std::cout << "Peeked: " << c1 << " got: " << c2 << '\n';
}

出力:

Peeked: H got: H

[編集] 参照

文字を抽出します
Original:
extracts characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
文字の抽出を取り消します
Original:
unextracts a character
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]