Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>ofstream file output stream</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ofstream             File Output Stream


            The ofstream is used for file output (binary or text). The
    important member functions of ofstream are:

 ostream &put(ch);    Put one char to stream associated with object
 unsigned char *buf;    Data buffer
 int num;               Number of bytes to read

 ostream &write(buf, num);    Write num bytes to this object's stream
 unsigned char *buf;    Data buffer
 int num;               Number of bytes to write

 void open(filename, mode, access);   Open a file.
 char *filename;        The file's name
 int mode;              Open mode:
                          in  = 0x01        Open for reading
                          out = 0x02        Open for writing
                          ate = 0x04        Seek to eof upon open
                          app = 0x08        Append mode
                          trunc = 0x10      Truncate file if already exists
                          nocreate = 0x20   Open fails if doesn't exist
                          noreplace = 0x40  Open fails if already exists
                          binary = 0x80     Binary (not text) file
 int access;            Access:
                          0 = Normal file
                          1 = Read-only file
                          2 = Hidden file
                          4 = System file
                          8 = Archive bit set

 void close();   Close file associated with this object (no parameters).

 int eof();      Return nonzero value when the end of the file is reached.

 ostream &seekp(offset, origin);      Move data put pointer
 streamoff offset;      Type defined in IOSTREAM.H
 seek_dir origin;       Seek_dir is an enumeration; possible values:
                           ios::beg  =  Beginning
                           ios::cur  =  Current location
                           ios::end  =  End

See Also: ifstream fstream

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson