std::basic_fstream::basic_fstream
提供:cppreference.com
< cpp | io | basic fstream
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| basic_fstream(); |
(1) | |
| basic_fstream( const char* filename, ios_base::openmode mode = ios_base::in|ios_base::out ); |
(2) | |
| basic_fstream( const string& filename, ios_base::openmode mode = ios_base::in|ios_base::out ); |
(3) | (C + + 11以来) |
| basic_fstream( basic_fstream&& other ); |
(4) | (C + + 11以来) |
| basic_fstream( const basic_fstream& rhs) = delete; |
(5) | |
新しいファイル·ストリームを構築し.
Original:
Constructs new file stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
1)
デフォルトコンストラクタは:ファイルに関連付けられていないストリームを構築します。std::basic_filebufのデフォルトは-構築し、このデフォルト·構築std::basic_filebufメンバへのポインタを持つ基盤を構築し.
Original:
Default constructor: constructs a stream that is not associated with a file: default-constructs the std::basic_filebuf and constructs the base with the pointer to this default-constructed std::basic_filebuf member.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
最初に、デフォルトコンストラクタと同じ手順を実行し、その後rdbuf()->open(filename, mode).を呼び出すことによって、ファイルを使用してストリームをasssociate。 open()の呼び出しはnullポインタを返す場合は、setstate(failbit)設定.
Original:
First, performs the same steps as the default constructor, then asssociate the stream with a file by calling rdbuf()->open(filename, mode).. If the open() call returns a null pointer, sets setstate(failbit).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
3)
basic_fstream(filename.c_str(), mode)と同じ.
Original:
Same as basic_fstream(filename.c_str(), mode).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
4)
コンストラクタを移動します。まず、
otherから基底クラス(rdbuf()ポインタには影響しませんが)ムーブ構築し、その後、std::basic_filebuf部材を移動させる構築物this->set_rdbuf()は、基本クラスでbasic_filebufポインタとして新しいrdbuf()をインストールするために呼び出し.Original:
Move constructor. First, move-constructs the base class from
other (which does not affect the rdbuf() pointer), then move-constructs the std::basic_filebuf member, then calls this->set_rdbuf() to install the new basic_filebuf as the rdbuf() pointer in the base class.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
5)
コピーコンストラクタは削除されます:このクラスがコピーできません.
Original:
The copy-constructor is deleted: this class is not copyable.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] パラメータ
| filename | - | ファイルの名前を開くことができます
Original: the name of the file to be opened The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mode | - | ストリームのオープンモードを指定します。それはビットマスク型ですが、以下の定数が定義されています:
Original: specifies stream open mode. It is bitmask type, the following constants are defined:
The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| other | - | ソースとして使用する別のファイルストリーム
Original: another file stream to use as source The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[編集] 例
#include <fstream> #include <utility> #include <string> int main() { std::fstream f0; std::fstream f1("test.bin", std::ios::binary); std::string name = "example.txt"; std::fstream f2(name); std::fstream f3(std::move(f1)); }
[編集] も参照してください
| ストリームとファイルと関連付け、それを開きます Original: opens a file and associates it with the stream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
| ファイルを開き、関連した文字シーケンスとして設定されます Original: opens a file and configures it as the associated character sequence The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数of std::basic_filebuf)
| |
| そのエラー状態をクリアせずに rdbufを置き換えますOriginal: replaces the rdbuf without clearing its error stateThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (メンバー関数を保護しました) | |
| オブジェクトを作成します Original: constructs the object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数of std::basic_iostream)
| |