class
std::ofstream
<fstream>
Output file stream
ofstream provides an interface to write data to files as output streams.
The objects of this class maintain internally a pointer to a
filebuf object that can be obtained by calling member
rdbuf.
The file to be associated with the stream can be specified either as a parameter in the
constructor or by calling member
open.
After all necessary operations on a file have been performed, it can be closed (or disassociated) by calling member
close. Once closed, the same file stream object may be used to open another file.
The member function
is_open can be used to determine whether the stream object is currently associated with a file.
Public members
- (constructor)
- Construct object and optionally open file (public member function)
- rdbuf
- Get the associated filebuf object (public member function)
- is_open
- Check if a file is open (public member function)
- open
- Open file (public member function)
- close
- Close file (public member function)
Members inherited from ostream
- operator<<
- Insert data with format (public member function)
- put
- Put character (public member function)
- write
- Write block of data (public member function)
- tellp
- Get position of put pointer (public member function)
- seekp
- Set position of put pointer (public member function)
- flush
- Flush output stream buffer (public member function)
- sentry
- Perform exception safe prefix/suffix operations (public member class)
Member functions inherited from ios
- good
- Check if the state of the stream is good for i/o operations. (public member function)
- eof
- Check if eofbit is set (public member function)
- fail
- Check if either failbit or badbit is set (public member function)
- bad
- Check if badbit is set (public member function)
- operator!
- Evaluate stream object (public member function)
- operator void*
- Convert to pointer (public member function)
- rdstate
- Get error state flags (public member function)
- setstate
- Set error state flag (public member function)
- clear
- Set error state flags (public member function)
- copyfmt
- Copy formatting information (public member function)
- fill
- Get/set the fill character (public member function)
- exceptions
- Get/set exception mask (public member function)
- imbue
- Imbue locale (public member function)
- tie
- Get/set the tied stream (public member function)
- narrow
- Narrow character (public member function)
- widen
- Widen character (public member function)
Member functions inherited from ios_base
- flags
- Get/set format flags (public member function)
- setf
- Set specific format flags (public member function)
- unsetf
- Clear specific format flags (public member function)
- precision
- Get/Set floating-point decimal precision (public member function)
- width
- Get/set field width (public member function)
- imbue
- Imbue locale (public member function)
- getloc
- Get current locale (public member function)
- xalloc
- Return a new index for the internal extensible array [static] (public static member function)
- iword
- Get reference to integer element of the internal extensible array (public member function)
- pword
- Get reference to pointer of the internal extensible array (public member function)
- register_callback
- Register event callback function (public member function)
- sync_with_stdio
- Activate/deactivate synchronization of iostream and cstdio streams [static] (public static member function)