Native/C++

ofstream (File output stream class)

aucd29 2013. 10. 2. 19:02
File output stream class

Standard hierarchy

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

Public member functions:

ofstream members:
(constructor) Construct an object and optionally open a file.
rdbuf Get the filebuf object associated with the stream.
is_open Check if a file has been opened.
open Open a file.
close Close an open file.
members inherited ostream:
operator<< Perform a formatted output operation (insertion).
flush Flush buffer.
put Put a single character into output stream.
seekp Set position of put pointer.
tellp Get position of put pointer.
write Write a sequence of characters.
members inherited from ios:
operator void * Convert stream to pointer.
operator ! Evaluate stream object.
bad Check if an unrecoverable error has occurred.
clear Set control states.
copyfmt Copy formatting information.
eof Check if End-Of-File has been reached.
exceptions Get/set the exception mask.
fail Check if failure has occurred.
fill Get/set the fill character.
good Check if stream is good for i/o operations.
imbue Imbue locale.
narrow Narrow character.
rdbuf Get/set the associated streambuf object.
rdstate Get control state.
setstate Set control state.
tie Get/set the tied stream.
widen Widen character.
members inherited from ios_base:
flags Get/set format flags.
getloc Get current locale.
imbue Imbue locale.
iword Get reference to a long element of the internal extensible array.
precision Get/set floating-point decimal presision.
pword Get reference to a void* element of the internal extensible array.
register_callback Register event callback function.
setf Set some format flags.
sync_with_stdio Activates / Deactivates synchronization with cstdio functions. [static]
unsetf Clear format flag.
width Get/set field width.
xalloc Return 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.