85 lines
2.5 KiB
Markdown
85 lines
2.5 KiB
Markdown
[ifstream.members]
|
||
|
||
# 31 Input/output library [[input.output]](./#input.output)
|
||
|
||
## 31.10 File-based streams [[file.streams]](file.streams#ifstream.members)
|
||
|
||
### 31.10.4 Class template basic_ifstream [[ifstream]](ifstream#members)
|
||
|
||
#### 31.10.4.4 Member functions [ifstream.members]
|
||
|
||
[ð](#lib:rdbuf,basic_ifstream)
|
||
|
||
`basic_filebuf<charT, traits>* rdbuf() const;
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L11949)
|
||
|
||
*Returns*: const_cast<basic_filebuf<charT, traits>*>(addressof(*sb*))[.](#1.sentence-1)
|
||
|
||
[ð](#lib:native_handle,basic_ifstream)
|
||
|
||
`native_handle_type native_handle() const noexcept;
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L11960)
|
||
|
||
*Effects*: Equivalent to: return rdbuf()->native_handle();
|
||
|
||
[ð](#lib:is_open,basic_ifstream)
|
||
|
||
`bool is_open() const;
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L11971)
|
||
|
||
*Returns*: rdbuf()->is_open()[.](#3.sentence-1)
|
||
|
||
[ð](#lib:open,basic_ifstream)
|
||
|
||
`void open(const char* s, ios_base::openmode mode = ios_base::in);
|
||
void open(const filesystem::path::value_type* s,
|
||
ios_base::openmode mode = ios_base::in); // wide systems only; see [[fstream.syn]](fstream.syn "31.10.1 Header <fstream> synopsis")
|
||
`
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L11984)
|
||
|
||
*Effects*: Callsrdbuf()->open(s, mode | ios_base::in)[.](#4.sentence-1)
|
||
|
||
If that function does not return a null pointer
|
||
calls clear(),
|
||
otherwise callssetstate(failbit) (which may throwios_base::failure) ([[iostate.flags]](iostate.flags "31.5.4.4 Flags functions"))[.](#4.sentence-2)
|
||
|
||
[ð](#lib:open,basic_ifstream_)
|
||
|
||
`void open(const string& s, ios_base::openmode mode = ios_base::in);
|
||
void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in);
|
||
`
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12003)
|
||
|
||
*Effects*: Calls open(s.c_str(), mode)[.](#5.sentence-1)
|
||
|
||
[ð](#lib:close,basic_ifstream)
|
||
|
||
`void close();
|
||
`
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12014)
|
||
|
||
*Effects*: Callsrdbuf()->close() and, if that function returns
|
||
a null pointer,
|
||
callssetstate(failbit) (which may throwios_base::failure) ([[iostate.flags]](iostate.flags "31.5.4.4 Flags functions"))[.](#6.sentence-1)
|