std::basic_ifstream<CharT,Traits>::open
提供: cppreference.com
< cpp | io | basic ifstream
void open( const char *filename, ios_base::openmode mode = ios_base::in ); |
(1) | |
void open( const std::filesystem::path::value_type *filename, ios_base::openmode mode = ios_base::in ); |
(2) | (C++17以上) |
void open( const std::string &filename, ios_base::openmode mode = ios_base::in ); |
(3) | (C++11以上) |
void open( const std::filesystem::path &filename, ios_base::openmode mode = ios_base::in ); |
(4) | (C++17以上) |
名前 filename
を持つファイルを開き、それをファイルストリームと紐付けます。
失敗した場合は setstate(failbit) を呼びます。
成功した場合は clear() を呼びます。 | (C++11以上) |
1-2) 実質的に rdbuf()->open(filename, mode | ios_base::in) を呼びます (呼び出しの効果の詳細は std::basic_filebuf::open を参照してください)。 オーバーロード (2) は std::filesystem::path::value_type が char でない場合にのみ提供されます。 (C++17以上)
3-4) 実質的に、 open(filename.c_str(), mode) によって行われたかのように、 (1-2) を呼びます。
目次 |
[編集] 引数
filename | - | 開くファイルの名前 | ||||||||||||||
mode | - | ストリームのオープンモードを指定します。 これはビットマスク型であり、以下の定数が定義されています。
|
[編集] 戻り値
(なし)
[編集] 例
This section is incomplete Reason: no example |
[編集] 関連項目
ストリームが紐付けられているファイルを持っているかどうか調べます (パブリックメンバ関数) | |
紐付けられているファイルを閉じます (パブリックメンバ関数) | |
ファイルを開き、それを文字シーケンスとして紐付けます ( std::basic_filebuf<CharT,Traits> のパブリックメンバ関数)
|