名前空間
変種
操作

std::basic_istream::operator>>

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

 
 
入力/出力ライブラリ
I / Oのマニピュレータ
CスタイルのI / O
バッファ
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(廃止予定)
ストリーム
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽象化
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
ファイルI / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
文字列I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
アレイのI / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(廃止予定)
ostrstream(廃止予定)
strstream(廃止予定)
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
エラーカテゴリインターフェース
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
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.
cin
wcin
メンバ関数
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.
basic_istream::basic_istream
basic_istream::~basic_istream
basic_istream::operator=(C++11)
書式付き入力
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.
basic_istream::operator>>
書式なし入力
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::get
basic_istream::peek
basic_istream::unget
basic_istream::putback
basic_istream::getline
basic_istream::ignore
basic_istream::read
basic_istream::readsome
basic_istream::gcount
ポジショニング
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::tellg
basic_istream::seekg
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::sync
basic_istream::swap(C++11)
メンバークラス
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.
basic_istream::sentry
非メンバ関数
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.
operator>>(std::basic_istream)
 
basic_istream& operator>>( short& value );
basic_istream& operator>>( unsigned short& value );
(1)
basic_istream& operator>>( int& value );
basic_istream& operator>>( unsigned int& value );
(2)
basic_istream& operator>>( long& value );
basic_istream& operator>>( unsigned long& value );
(3)
basic_istream& operator>>( long long& value );
basic_istream& operator>>( unsigned long long& value );
(4) (C + + 11以来)
basic_istream& operator>>( float& value );

basic_istream& operator>>( double& value );

basic_istream& operator>>( long double& value );
(5)
basic_istream& operator>>( bool& value );
(6)
basic_istream& operator>>( void*& value );
(7)
basic_istream& operator>>( basic_istream& st,

                           std::ios_base& (*func)(std::ios_base&) );
basic_istream& operator>>( basic_istream& st,
                           std::basic_ios<CharT,Traits>& (*func)(std::basic_ios<CharT,Traits>&) );
basic_istream& operator>>( basic_istream& st,

                           std::basic_istream& (*func)(std::basic_istream&) );
(8)
basic_istream& operator>>( basic_istream& st,
                           std::basic_streambuf<CharT,Traits>* sb );
(9)
1-4)
num_get::get()呼び出して整数値を抽出します
Original:
Extracts an integer value by calling num_get::get()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
num_get::get()を呼び出すことにより、浮動小数点値を抽出します
Original:
Extracts a floating point value by calling num_get::get()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
抽出boolnum_get::get()を呼び出して値を指定します
Original:
Extracts bool value by calling num_get::get()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
num_get::get()を呼び出すことによって、一般的なポインタ値を抽出します
Original:
Extracts a generic pointer value by calling num_get::get()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
func(*this);は、I / Oマニピュレータですコールはfunc、.
Original:
Calls func(*this);, where func is an I/O manipulator.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
UnformattedInputFunctionとして動作します。監視オブジェクトを構築し、チェックした後に、入力ストリームからすべてのデータを抽出し、sbに格納します。次のいずれかの条件が満たされていれば抽出は停止します
Original:
Behaves as an UnformattedInputFunction. After constructing and checking the sentry object, extracts all data from the input stream and stores it to sb. The extraction stops if one of the following conditions are met:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • エンド·オブ·ファイルは、入力シーケンスで発生します;
    Original:
    end-of-file occurs on the input sequence;
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • (挿入される文字が抽出されていない場合には)失敗出力シーケンスに挿入する;
    Original:
    inserting in the output sequence fails (in which case the character to be inserted is not extracted);
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • 例外(例外がキャッチされている場合)に発生.
    Original:
    an exception occurs (in which case the exception is caught).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
いずれの場合も、gcount()への後続の呼び出しによってアクセスされるメンバ変数に抽出された文字の数を格納します
Original:
In either case, stores the number of characters extracted in the member variable accessed by subsequent calls to gcount()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] ノート

演算子の(1-7)のバージョンは次のように書式付き入力関数振る舞う。すなわち、彼らは必要に応じてのtie()をフラッシュ 'Dバッファ、エラーをチェックし、抽出液を破棄ios_bas​​eのない限り、すべての先行する空白文字という冒頭sentryオブジェクトを構築:: skipwsフラグがクリアされました。入力はsentryオブジェクトがtrueを返した場合にのみ試行されます.
Original:
The (1-7) versions of the operator behave as formatted input functions. That is, they construct a sentry object at the beginning that flushes the tie()'d buffers if needed, checks for errors, and extracts and discards all leading whitespace characters unless the ios_base::skipws flag was cleared. The input is attempted only if the sentry object returns true.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
バージョン8)監視オブジェクトを構築しません。バージョン9)noskipwsに設定true付き監視オブジェクトを構築し.
Original:
The version 8) does not construct the sentry object. The version 9) constructs a sentry object with noskipws set to true.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽出に失敗した場合(例えば、数字が予想される文字が入力された場合)、valueは変更されないとfailbit(C + + 11時まで)設定されています
Original:
If extraction fails (e.g. if a letter was entered where a digit is expected), value is left unmodified and failbit is set (C + + 11時まで)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽出に失敗した場合は、ゼロがvalueに書き込まれ、failbitが設定されます。もしvalue内に収まるには大きすぎるか小さすぎる値の抽出結果、std::numeric_limits<T>::max()またはstd::numeric_limits<T>::min()書かれており、failbitフラグが設定されている。 (C + + 11以来)
Original:
If extraction fails, zero is written to value and failbit is set. If extraction results in the value too large or too small to fit in value, std::numeric_limits<T>::max() or std::numeric_limits<T>::min() is written and failbit flag is set. (C + + 11以来)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] パラメータ

value -
参照に抽出された値を格納する
Original:
reference to an integer or floating-point value to store the extracted value to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
func -
へのポインタI / Oのマニピュレータ関数
Original:
pointer to I/O manipulator function
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
sb -
すべてのデータを書き込むためのストリームバッファへのポインタ
Original:
pointer to the streambuffer to write all the data to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

*this

[編集]

#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
    std::string input = "41 3.14 false hello world";
    std::istringstream stream(input);
    int n;
    double f;
    bool b;
 
    stream >> n >> f >> std::boolalpha >> b;
    std::cout << "n = " << n << '\n'
              << "f = " << f << '\n'
              << "b = " << std::boolalpha << b << '\n';
 
    // extract the rest using the streambuf overload
    stream >> std::cout.rdbuf();
    std::cout << '\n';
}

Output:

n = 41
f = 3.14
b = false
hello world

[編集] も参照してください

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

(関数テンプレート) [edit]
文字列のストリームI / Oを実行します
Original:
performs stream I/O of strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)
ビット集合のストリームの入力と出力を行います
Original:
performs stream input and output of bitsets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能)
複素数をシリアライズしてデシリアライズします
Original:
serializes and deserializes a complex number
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート)
擬似乱数エンジンにストリーム入出力を行います
Original:
performs stream input and output on pseudo-random number engine
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]
擬似乱数分布にストリーム入出力を行います
Original:
performs stream input and output on pseudo-random number distribution
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]
文字のブロックを抽出します
Original:
extracts blocks of 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:
extracts already available blocks of 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:
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:
extracts characters until the given character is found
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

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