basic_ofstream
ofstream
wofstream
File output stream class
iostream library
  cplusplus.com  

Standard hierarchy

ios_base
--->
ios
--->
ostream
--->
ofstream

Public member functions:

ofstream members:
(constructor)Construct an object and optionally open a file.
rdbufGet the filebuf object associated with the stream.
is_openCheck if a file has been opened.
openOpen a file.
closeClose an open file.
members inherited ostream:
operator<<Perform a formatted output operation (insertion).
flushFlush buffer.
putPut a single character into output stream.
seekpSet position of put pointer.
tellpGet position of put pointer.
writeWrite a sequence of characters.
members inherited from ios:
operator void *Convert stream to pointer.
operator !Evaluate stream object.
badCheck if an unrecoverable error has occurred.
clearSet control states.
copyfmtCopy formatting information.
eofCheck if End-Of-File has been reached.
exceptionsGet/set the exception mask.
failCheck if failure has occurred.
fillGet/set the fill character.
goodCheck if stream is good for i/o operations.
imbueImbue locale.
narrowNarrow character.
rdbufGet/set the associated streambuf object.
rdstateGet control state.
setstateSet control state.
tieGet/set the tied stream.
widenWiden character.
members inherited from ios_base:
flagsGet/set format flags.
getlocGet current locale.
imbueImbue locale.
iwordGet reference to a long element of the internal extensible array.
precisionGet/set floating-point decimal presision.
pwordGet reference to a void* element of the internal extensible array.
register_callbackRegister event callback function.
setfSet some format flags.
sync_with_stdioActivates / Deactivates synchronization with cstdio functions. [static]
unsetfClear format flag.
widthGet/set field width.
xallocReturn a new index for the internal extensible array. [static]

Description

  ofstream class provides a stream interface to write data to files.
  The class mantains internally (privately) a pointer to a filebuf object in charge of the interaction with the file. This pointer can be obtained/modified by calling member rdbuf.
  The file to be processed can be specified as a parameter for the constructor or by calling member open.
  After a file is processed it can be closed by calling member close. In this case the file stream may be used to open another file.
  Member is_open can be used to determine wether the stream is currently operating on a file or not.
  Please refer to parent classes for more details on information mantained by an ofstream object.


© The C++ Resources Network, 2001