Files
2025-10-25 03:02:53 +03:00

85 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.1Header <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.4Flags 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.4Flags functions"))[.](#6.sentence-1)