Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

basic_ofstream

Library:  Input/output


basic_ofstream basic_ostream basic_ios ios_base

Local Index

Members

Non-Members

Summary

Class that supports writing into named files or other devices associated with a file descriptor

Synopsis

#include <fstream> 

namespace std {
  template<class charT, class traits = char_traits<charT> >
  class basic_ofstream;
}

Description

The class template basic_ofstream supports writing into named files or other devices associated with a file descriptor. It uses a basic_filebuf object to control the associated sequences. It inherits from basic_ostream and can therefore use all the formatted and unformatted output functions.

Interface

Member Types

char_type
off_type
int_type
pos_type
traits_type

Nonmember Types

ofstream
wofstream

Constructors

basic_ofstream();
explicit 
basic_ofstream(const char* s, 
               ios_base::openmode mode = ios_base::out);
basic_ofstream(const char* s, 
               ios_base::openmode mode = ios_base::out,
               long protection = 0666);

NOTE -- This function is not part of the C++ Standard, but is included here as an extension. See Appendix B for a complete list of extensions of this implementation.
basic_ofstream(int fd, char_type *buf, streamsize n); 

NOTE -- This function is not part of the C++ Standard, but is included here as an extension in order to manipulate pipes, sockets, or other UNIX devices that can be accessed through file descriptors. See Appendix B for a complete list of extensions of this implementation.
basic_ofstream(FILE *fp, char_type* buf, streamsize n); 

NOTE -- This function is not part of the C++ Standard, but is provided here as an extension. See Appendix B for a complete list of extensions of this implementation.

Member Functions

void 
close();
bool 
is_open();
void 
open(const char* s,ios_base::openmode = ios_base::out);
void 
open(const char* s, ios_base::openmode, long protection);

NOTE -- This function does not appear in the C++ Standard, but is included here as an extension. See Appendix B for a complete list of extensions of this implementation.
void 
open(int fd, char_type *buf = 0, 
     streamsize n = /* default size */);

NOTE -- This function is not part of the C++ Standard, but is provided here as an extension. See Appendix B for a complete list of extensions of this implementation.
void 
open (FILE *fp, char_type *buf = 0, 
      streamsize n = /* default size */);

NOTE -- This function is not part of the C++ Standard, but is provided here as a convenience extension. See Appendix B for a complete list of extensions of this implementation.
basic_filebuf<charT,traits>* 
rdbuf() const; 

Example

See basic_fstream, basic_ifstream, and basic_filebuf examples.

See Also

char_traits, ios_base, basic_ios, basic_filebuf, basic_ifstream, basic_fstream

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems --Programming Language C++, Section 27.8.1.8



Previous fileTop of DocumentContentsIndex pageNext file