# <fstream>
<fstream>
# ``
* * *
Include the [iostreams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_cpp.html#iostreams)
standard header **``**
to define several classes that support
iostreams operations on
sequences stored in external
[files](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#files).
namespace std {
template >
class basic_filebuf;
typedef basic_filebuf filebuf;
typedef basic_filebuf wfilebuf;
template >
class basic_ifstream;
typedef basic_ifstream ifstream;
typedef basic_ifstream wifstream;
template >
class basic_ofstream;
typedef basic_ofstream ofstream;
typedef basic_ofstream wofstream;
template >
class basic_fstream;
typedef basic_fstream fstream;
typedef basic_fstream wfstream;
} // namespace stdCopy to clipboard
## `basic_filebuf`
template >
class basic_filebuf : public basic_streambuf {
public:
typedef typename basic_streambuf::char_type
char_type;
typedef typename basic_streambuf::traits_type
traits_type;
typedef typename basic_streambuf::int_type
int_type;
typedef typename basic_streambuf::pos_type
pos_type;
typedef typename basic_streambuf::off_type
off_type;
basic_filebuf();
bool is_open() const;
basic_filebuf *open(const char *filename,
ios_base::openmode mode);
basic_filebuf *close();
protected:
virtual pos_type seekoff(off_type off,
ios_base::seekdir way,
ios_base::openmode which =
ios_base::in | ios_base::out);
virtual pos_type seekpos(pos_type pos,
ios_base::openmode which =
ios_base::in | ios_base::out);
virtual int_type underflow();
virtual int_type pbackfail(int_type meta =
traits_type::eof());
virtual int_type overflow(int_type meta =
traits_type::eof());
virtual int sync();
virtual basic_streambuf
*setbuf(Elem *buffer, streamsize count);
};Copy to clipboard
The template class
describes a **[stream buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#stream%20buffer)** that controls
the transmission of elements
of type `Elem`, whose
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits) are determined by the
class `Tr`,
to and from a sequence of elements stored in an external
[file](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#files).
An object of class
`basic_filebuf` stores a
**file pointer**, which designates the
`FILE` object
that controls the **[stream](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#stream)**
associated with an
[open](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#file%20open) file.
It also stores pointers to two
**[file conversion facets](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20conversion%20facet)**
for use by the protected member functions
`overflow` and
`underflow`.
### `basic_filebuf::basic_filebuf`
basic_filebuf();Copy to clipboard
The constructor stores a null pointer in all the pointers
controlling the
[input buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#input%20buffer) and the
[output buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#output%20buffer). It
also stores a null pointer in the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer).
### `basic_filebuf::char_type`
typedef Elem char_type;Copy to clipboard
The type is a synonym for the template parameter `Elem`.
### `basic_filebuf::close`
basic_filebuf *close();Copy to clipboard
The member function returns a null pointer if the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer) `fp`
is a null pointer. Otherwise, it calls
`fclose(fp)`.
If that function returns a nonzero value, the function
returns a null pointer. Otherwise, it returns `this`
to indicate that the file was successfully
[closed](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#file%20close).
For a wide stream,
if any insertions have occured since the stream was opened, or since the last
call to `streampos`, the function calls
`overflow()`.
It also inserts any sequence needed to restore the
[initial conversion state](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_charset.html#initial%20conversion%20state),
by using the
[file conversion facet](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20conversion%20facet)
`fac` to call
`fac.unshift`
as needed. Each element `byte` of type *char* thus
produced is written to the associated stream designated by the
file pointer `fp` as if by successive calls of the form
`fputc(byte, fp)`.
If the call to `fac.unshift` or any write fails,
the function does not succeed.
### `basic_filebuf::int_type`
typedef typename traits_type::int_type int_type;Copy to clipboard
The type is a synonym for
`traits_type::int_type`.
### `basic_filebuf::is_open`
bool is_open();Copy to clipboard
The member function returns true if the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer) is not a null pointer.
### `basic_filebuf::off_type`
typedef typename traits_type::off_type off_type;Copy to clipboard
The type is a synonym for
`traits_type::off_type`.
### `basic_filebuf::open`
basic_filebuf *open(const char *filename,
ios_base::openmode mode);Copy to clipboard
The member function endeavors to open the file with
[filename](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_over.html#filename) `filename`, by calling
`fopen(filename, strmode)`. Here
`strmode` is determined from `mode &
~(ate |
binary)`:
- `ios_base::in`
becomes `"r"` (open existing file for reading).
- `ios_base::out` or
`ios_base::out |
ios_base::trunc`
becomes `"w"` (truncate existing file or create for writing).
- `ios_base::out |
ios_base::app`
becomes `"a"` (open existing file for appending all writes).
- `ios_base::in | ios_base::out`
becomes `"r+"` (open existing file for reading and writing).
- `ios_base::in | ios_base::out |
ios_base::trunc` becomes `"w+"`
(truncate existing file or create for reading and writing).
- `ios_base::in | ios_base::out |
ios_base::app` becomes `"a+"`
(open existing file for reading and for appending all writes).
If `mode & ios_base::binary` is nonzero,
the function appends `b` to `strmode`
to open a [binary stream](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#binary%20stream)
instead of a [text stream](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#text%20stream).
It then stores the value returned by `fopen` in the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer) `fp`. If
`mode & ios_base::ate` is nonzero and the
file pointer is not a null pointer, the function calls
`fseek(fp, 0,
SEEK_END)` to
position the stream at end-of-file. If that positioning operation
fails, the function calls
`close(fp)` and
stores a null pointer in the file pointer.
If the file pointer is not a null pointer, the function
determines the
**file conversion facet**:
`use_facet<
codecvt
>(getloc())`,
for use by
`underflow`
and
`overflow`.
If the file pointer is a null pointer, the function returns
a null pointer. Otherwise, it returns `this`.
### `basic_filebuf::overflow`
virtual int_type overflow(int_type meta =
traits_type::eof());Copy to clipboard
If `meta !=
traits_type::eof()`,
the protected virtual member function endeavors to insert the element
`ch = traits_type::to_char_type(meta)`
into the
[output buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#output%20buffer).
It can do so in various ways:
- If a [write position](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#write%20position)
is available, it can store the element into the write position
and increment the next pointer for the output buffer.
- It can make a write position available by allocating
new or additional storage for the output buffer.
- It can convert any pending output in the output buffer, followed
by `ch`, by using the
[file conversion facet](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20conversion%20facet)
`fac` to call
`fac.out`
as needed. Each element `ch` of type *char* thus
produced is written to the associated stream designated by the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer) `fp`
as if by successive calls of the form
`fputc(ch, fp)`.
If any conversion or write fails, the function does not succeed.
If the function cannot succeed, it returns `traits_type::eof()`.
Otherwise, it returns
`traits_type::not_eof(meta)`.
### `basic_filebuf::pbackfail`
virtual int_type pbackfail(int_type meta =
traits_type::eof());Copy to clipboard
The protected virtual member function endeavors to put back an element
into the
[input buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#input%20buffer),
then make it the current element (pointed to
by the next pointer). If `meta ==
traits_type::eof()`,
the element to push back is effectively the one already in the stream
before the current element. Otherwise, that element is replaced by
`ch =
traits_type::to_char_type(meta)`.
The function can put back an element in various ways:
- If a [putback position](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#putback%20position)
is available, and the element stored there compares equal to `ch`,
it can simply decrement the next pointer for the input buffer.
- If the function can make a putback position available,
it can do so, set the next pointer to point at that position,
and store `ch` in that position.
- If the function can push back an element onto the input stream,
it can do so, such as by calling
`ungetc` for an element
of type *char.*
If the function cannot succeed, it returns
`traits_type::eof()`. Otherwise, it returns
`traits_type::not_eof(meta)`.
### `basic_filebuf::pos_type`
typedef typename traits_type::pos_type pos_type;Copy to clipboard
The type is a synonym for
`traits_type::pos_type`.
### `basic_filebuf::seekoff`
virtual pos_type seekoff(off_type off,
ios_base::seekdir way,
ios_base::openmode which =
ios_base::in | ios_base::out);Copy to clipboard
The protected virtual member function endeavors to alter the current
positions for the controlled streams. For an object of class
`basic_filebuf`, a stream position can be represented
by an object of type
`fpos_t`, which stores an
offset and any state information needed to parse a
[wide stream](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#wide%20stream).
Offset zero designates the first element of the stream.
(An object of type
`pos_type`
stores at least an `fpos_t` object.)
For a file opened for both reading and writing,
both the input and output streams are positioned in tandem. To
[switch](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#Stream%20States)
between inserting and extracting, you must call either
`pubseekoff`
or
`pubseekpos`.
Calls to `pubseekoff` (and hence to `seekoff`)
have various limitations for
[text streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#text%20stream),
[binary streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#binary%20stream), and
[wide streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#wide%20stream).
If the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer) `fp`
is a null pointer, the function fails. Otherwise, it endeavors
to alter the stream position by calling
`fseek(fp, off, way)`.
If that function succeeds and the resultant position
`fposn` can be determined by calling
`fgetpos(fp, &fposn)`,
the function succeeds. If the function succeeds, it returns
a value of type `pos_type` containing `fposn`.
Otherwise, it returns an invalid stream position.
### `basic_filebuf::seekpos`
virtual pos_type seekpos(pos_type pos,
ios_base::openmode which =
ios_base::in | ios_base::out);Copy to clipboard
The protected virtual member function endeavors to alter the current
positions for the controlled streams. For an object of class
`basic_filebuf`, a stream position can be represented
by an object of type
`fpos_t`, which stores an
offset and any state information needed to parse a
[wide stream](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#wide%20stream).
Offset zero designates the first element of the stream.
(An object of type
`pos_type`
stores at least an `fpos_t` object.)
For a file opened for both reading and writing,
both the input and output streams are positioned in tandem. To
[switch](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#Stream%20States)
between inserting and extracting, you must call either
`pubseekoff`
or
`pubseekpos`.
Calls to `pubseekoff` (and hence to `seekoff`)
have various limitations for
[text streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#text%20stream),
[binary streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#binary%20stream), and
[wide streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#wide%20stream).
For a wide stream,
if any insertions have occured since the stream was opened, or since the last
call to `streampos`, the function calls
`overflow()`.
It also inserts any sequence needed to restore the
[initial conversion state](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_charset.html#initial%20conversion%20state),
by using the
[file conversion facet](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20conversion%20facet)
`fac` to call
`fac.unshift`
as needed. Each element `byte` of type *char* thus
produced is written to the associated stream designated by the
file pointer `fp` as if by successive calls of the form
`fputc(byte, fp)`.
If the call to `fac.unshift` or any write fails,
the function does not succeed.
If the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer) `fp`
is a null pointer, the function fails. Otherwise, it endeavors
to alter the stream position by calling
`fsetpos(fp, &fposn)`,
where `fposn` is the `fpos_t` object stored
in `pos`. If that function succeeds, the function returns
`pos`. Otherwise, it returns an invalid stream position.
### `basic_filebuf::setbuf`
virtual basic_streambuf
*setbuf(Elem *buffer, streamsize count);Copy to clipboard
The protected member function returns zero if the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer) `fp`
is a null pointer. Otherwise, it calls
`setvbuf(fp, (char *)buffer,
_IOFBF, count * sizeof (Elem))`
to offer the array of `count` elements beginning at `buffer`
as a buffer for the stream. If that function returns a nonzero value,
the function returns a null pointer. Otherwise, it returns `this`
to signal success.
### `basic_filebuf::sync`
int sync();Copy to clipboard
The protected member function returns zero if the
[file pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20pointer) `fp`
is a null pointer. Otherwise, it returns zero only if calls to both
`overflow()` and
`fflush(fp)`
succeed in flushing any pending output to the stream.
### `basic_filebuf::traits_type`
typedef Tr traits_type;Copy to clipboard
The type is a synonym for the template parameter `Tr`.
### `basic_filebuf::underflow`
virtual int_type underflow();Copy to clipboard
The protected virtual member function endeavors to extract the current
element `ch` from the input stream, and return the element as
`traits_type::to_int_type(ch)`.
It can do so in various ways:
- If a [read position](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#read%20position) is available,
it takes `ch` as the element stored in the read position
and advances the next pointer for the
[input buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#input%20buffer).
- It can read one or more elements of type *char,*
as if by successive calls of the form
`fgetc(fp)`,
and convert them to an element `ch` of type `Elem`
by using the
[file conversion facet](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#file%20conversion%20facet)
`fac` to call
`fac.in`
as needed.
If any read or conversion fails,
the function does not succeed.
If the function cannot succeed, it returns
`traits_type::eof()`. Otherwise,
it returns `ch`, converted as described above.
## `basic_fstream`
template >
class basic_fstream : public basic_iostream {
public:
basic_fstream();
explicit basic_fstream(const char *filename,
ios_base::openmode mode =
ios_base::in | ios_base::out);
basic_filebuf *rdbuf() const;
bool is_open() const;
void open(const char *filename,
ios_base::openmode mode =
ios_base::in | ios_base::out);
void close();
};Copy to clipboard
The template class describes an object that controls
insertion and extraction of elements and encoded objects using a
[stream buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#stream%20buffer) of class
`basic_filebuf`,
with elements of type `Elem`, whose
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits) are determined
by the class `Tr`. The object stores an object of class
`basic_filebuf`.
### `basic_fstream::basic_fstream`
basic_fstream();
explicit basic_fstream(const char *filename,
ios_base::openmode mode =
ios_base::in | ios_base::out);Copy to clipboard
The first constructor initializes the base class by calling
`basic_iostream(sb)`,
where `sb` is the stored object of class
`basic_filebuf`.
It also initializes `sb` by calling
`basic_filebuf()`.
The second constructor initializes the base class by calling
`basic_iostream(sb)`.
It also initializes `sb` by calling
`basic_filebuf()`,
then `sb.open(filename, mode)`.
If the latter function returns a null pointer, the constructor calls
`setstate(failbit)`.
### `basic_fstream::close`
voidclose();Copy to clipboard
The member function calls
`rdbuf()->
close()`.
### `basic_fstream::is_open`
bool is_open();Copy to clipboard
The member function returns
`rdbuf()->
is_open()`.
### `basic_fstream::open`
void open(const char *filename,
ios_base::openmode mode =
ios_base::in | ios_base::out);Copy to clipboard
The member function calls
`rdbuf()->
open(filename, mode)`.
If that function returns a null pointer, the function calls
`setstate(failbit)`.
### `basic_fstream::rdbuf`
basic_filebuf *rdbuf() constCopy to clipboard
The member function returns the address of the stored
stream buffer, of type pointer to
`basic_filebuf`.
## `basic_ifstream`
template >
class basic_ifstream : public basic_istream {
public:
basic_filebuf *rdbuf() const;
basic_ifstream();
explicit basic_ifstream(const char *filename,
ios_base::openmode mode = ios_base::in);
bool is_open() const;
void open(const char *filename,
ios_base::openmode mode = ios_base::in);
void close();
};Copy to clipboard
The template class describes an object that controls
extraction of elements and encoded objects from a
[stream buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#stream%20buffer) of class
`basic_filebuf`,
with elements of type `Elem`, whose
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits) are determined
by the class `Tr`. The object stores an object of class
`basic_filebuf`.
### `basic_ifstream::basic_ifstream`
basic_ifstream();
explicit basic_ifstream(const char *filename,
ios_base::openmode mode = ios_base::in);Copy to clipboard
The first constructor initializes the base class by calling
`basic_istream(sb)`,
where `sb` is the stored object of class
`basic_filebuf`.
It also initializes `sb` by calling
`basic_filebuf()`.
The second constructor initializes the base class by calling
`basic_istream(sb)`.
It also initializes `sb` by calling
`basic_filebuf()`,
then `sb.open(filename, mode
| ios_base::in)`. If the latter function returns a null
pointer, the constructor calls
`setstate(failbit)`.
### `basic_ifstream::close`
void close();Copy to clipboard
The member function calls
`rdbuf()->
close()`.
### `basic_ifstream::is_open`
bool is_open();Copy to clipboard
The member function returns
`rdbuf()->
is_open()`.
### `basic_ifstream::open`
void open(const char *filename,
ios_base::openmode mode = ios_base::in);Copy to clipboard
The member function calls
`rdbuf()->
open(filename, mode | ios_base::in)`.
If that function returns a null pointer, the function calls
`setstate(failbit)`.
### `basic_ifstream::rdbuf`
basic_filebuf *rdbuf() constCopy to clipboard
The member function returns the address of the stored stream buffer.
## `basic_ofstream`
template >
class basic_ofstream : public basic_ostream {
public:
basic_filebuf *rdbuf() const;
basic_ofstream();
explicit basic_ofstream(const char *filename,
ios_base::openmode mode = ios_base::out);
bool is_open() const;
void open(const char *filename,
ios_base::openmode mode = ios_base::out);
void close();
};Copy to clipboard
The template class describes an object that controls
insertion of elements and encoded objects into a
[stream buffer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_streambu.html#stream%20buffer) of class
`basic_filebuf`,
with elements of type `Ele`, whose
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits) are determined
by the class `Tr`. The object stores an object of class
`basic_filebuf`.
### `basic_ofstream::basic_ofstream`
basic_ofstream();
explicit basic_ofstream(const char *filename,
ios_base::openmode which = ios_base::out);Copy to clipboard
The first constructor initializes the base class by calling
`basic_ostream(sb)`,
where `sb` is the stored object of class
`basic_filebuf`.
It also initializes `sb` by calling
`basic_filebuf()`.
The second constructor initializes the base class by calling
`basic_ostream(sb)`.
It also initializes `sb` by calling
`basic_filebuf()`,
then `sb.open(filename, mode
| ios_base::out)`. If the latter function returns a null
pointer, the constructor calls
`setstate(failbit)`.
### `basic_ofstream::close`
void close();Copy to clipboard
The member function calls
`rdbuf()->
close()`.
### `basic_ofstream::is_open`
bool is_open();Copy to clipboard
The member function returns
`rdbuf()->
is_open()`.
### `basic_ofstream::open`
void open(const char *filename,
ios_base::openmode mode = ios_base::out);Copy to clipboard
The member function calls
`rdbuf()->
open(filename, mode | ios_base::out)`.
If that function returns a null pointer, the function calls
`setstate(failbit)`.
### `basic_ofstream::rdbuf`
basic_filebuf *rdbuf() constCopy to clipboard
The member function returns the address of the stored
stream buffer.
## `filebuf`
typedef basic_filebuf > filebuf;Copy to clipboard
The type is a synonym for template class
[`basic_filebuf`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#basic_filebuf), specialized
for elements of type *char* with default
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits).
## `fstream`
typedef basic_fstream > fstream;Copy to clipboard
The type is a synonym for template class
[`basic_fstream`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#basic_fstream), specialized
for elements of type *char* with default
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits).
## `ifstream`
typedef basic_ifstream > ifstream;Copy to clipboard
The type is a synonym for template class
[`basic_ifstream`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#basic_ifstream), specialized
for elements of type *char* with default
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits).
## `ofstream`
typedef basic_ofstream >
ofstream;Copy to clipboard
The type is a synonym for template class
[`basic_ofstream`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#basic_ofstream), specialized
for elements of type *char* with default
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits).
## `wfstream`
typedef basic_fstream >
wfstream;Copy to clipboard
The type is a synonym for template class
[`basic_fstream`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#basic_fstream), specialized
for elements of type `wchar_t` with default
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits).
## `wifstream`
typedef basic_ifstream >
wifstream;Copy to clipboard
The type is a synonym for template class
[`basic_ifstream`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#basic_ifstream), specialized
for elements of type `wchar_t` with default
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits).
## `wofstream`
typedef basic_ofstream >
wofstream;Copy to clipboard
The type is a synonym for template class
[`basic_ofstream`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#basic_ofstream), specialized
for elements of type `wchar_t` with default
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits).
## `wfilebuf`
typedef basic_filebuf >
wfilebuf;Copy to clipboard
The type is a synonym for template class
[`basic_filebuf`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_fstream.html#basic_filebuf), specialized
for elements of type `wchar_t` with default
[character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits).
* * *
See also the
**[Table of Contents](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_index.html#Table%20of%20Contents)** and the
**[Index](https://docs.qualcomm.com/doc/80-N3040-23/topic/_cpp_index.html)**.
*[Copyright](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_crit_pjp.html) © 1992-2006by P.J. Plauger. All rights reserved.*
Last Published: Oct 06, 2026
Previous Topic
Next Topic