91 lines
2.6 KiB
Markdown
91 lines
2.6 KiB
Markdown
[fstream.members]
|
||
|
||
# 31 Input/output library [[input.output]](./#input.output)
|
||
|
||
## 31.10 File-based streams [[file.streams]](file.streams#fstream.members)
|
||
|
||
### 31.10.6 Class template basic_fstream [[fstream]](fstream#members)
|
||
|
||
#### 31.10.6.4 Member functions [fstream.members]
|
||
|
||
[ð](#lib:rdbuf,basic_fstream)
|
||
|
||
`basic_filebuf<charT, traits>* rdbuf() const;
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12479)
|
||
|
||
*Returns*: const_cast<basic_filebuf<charT, traits>*>(addressof(*sb*))[.](#1.sentence-1)
|
||
|
||
[ð](#lib:native_handle,basic_fstream)
|
||
|
||
`native_handle_type native_handle() const noexcept;
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12490)
|
||
|
||
*Effects*: Equivalent to: return rdbuf()->native_handle();
|
||
|
||
[ð](#lib:is_open,basic_fstream)
|
||
|
||
`bool is_open() const;
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12501)
|
||
|
||
*Returns*: rdbuf()->is_open()[.](#3.sentence-1)
|
||
|
||
[ð](#lib:open,basic_fstream)
|
||
|
||
`void open(
|
||
const char* s,
|
||
ios_base::openmode mode = ios_base::in | ios_base::out);
|
||
void open(
|
||
const filesystem::path::value_type* s,
|
||
ios_base::openmode mode = ios_base::in | ios_base::out); // 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#L12517)
|
||
|
||
*Effects*: Callsrdbuf()->open(s, mode)[.](#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_fstream_)
|
||
|
||
`void open(
|
||
const string& s,
|
||
ios_base::openmode mode = ios_base::in | ios_base::out);
|
||
void open(
|
||
const filesystem::path& s,
|
||
ios_base::openmode mode = ios_base::in | ios_base::out);
|
||
`
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12539)
|
||
|
||
*Effects*: Calls open(s.c_str(), mode)[.](#5.sentence-1)
|
||
|
||
[ð](#lib:close,basic_fstream)
|
||
|
||
`void close();
|
||
`
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12550)
|
||
|
||
*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)
|