StuBS
Loading...
Searching...
No Matches
FileOut Class Reference

Write text into file. More...

#include <file_out.h>

Inheritance diagram for FileOut:
Collaboration diagram for FileOut:

Public Member Functions

 FileOut (const char *path)
 Constructor.
 
virtual ~FileOut ()
 Destructor.
 
const char * getPath ()
 Get path of the output file.
 
virtual void flush () override
 Write the string to the open file.
 
- Public Member Functions inherited from OutputStream
 OutputStream ()
 Default constructor. Initial number system is decimal.
 
virtual ~OutputStream ()
 Destructor.
 
OutputStreamoperator<< (char c)
 Print a single character.
 
OutputStreamoperator<< (unsigned char c)
 Print a single character.
 
OutputStreamoperator<< (const char *string)
 Printing a null-terminated string.
 
OutputStreamoperator<< (bool b)
 Print a boolean value.
 
OutputStreamoperator<< (short ival)
 Print an integral number in radix base.
 
OutputStreamoperator<< (unsigned short ival)
 Print an integral number in radix base.
 
OutputStreamoperator<< (int ival)
 Print an integral number in radix base.
 
OutputStreamoperator<< (unsigned int ival)
 Print an integral number in radix base.
 
OutputStreamoperator<< (long ival)
 Print an integral number in radix base.
 
OutputStreamoperator<< (unsigned long ival)
 Print an integral number in radix base.
 
OutputStreamoperator<< (long long ival)
 Print an integral number in radix base.
 
OutputStreamoperator<< (unsigned long long ival)
 Print an integral number in radix base.
 
OutputStreamoperator<< (const void *ptr)
 Print a pointer as hexadecimal number.
 
OutputStreamoperator<< (OutputStream &(*f)(OutputStream &))
 Calls one of the manipulator functions.
 
- Public Member Functions inherited from Stringbuffer
virtual ~Stringbuffer ()
 Destructor (nothing to do here)
 

Static Public Member Functions

static int count ()
 Number of output files which are currently opened (with this class)
 

Additional Inherited Members

- Public Attributes inherited from OutputStream
int base
 Number system used for printing integral numbers (one of 2, 8, 10, or 16)
 
- Protected Member Functions inherited from Stringbuffer
 Stringbuffer ()
 Constructor; Marks the buffer as empty.
 
void put (char c)
 Inserts a character into the buffer.
 
- Protected Attributes inherited from Stringbuffer
char buffer [80+1]
 
long unsigned pos
 current position in the buffer
 

Detailed Description

Write text into file.

This class allows a comfortable output to a file only by using the elementary system calls open() / write() / close() and (optional) fsync(). The class is derived from OutputStream.

Constructor & Destructor Documentation

◆ FileOut()

FileOut::FileOut ( const char * path)
explicit

Constructor.

Opens the file for writing using the system call open().

Parameters
pathPath to the output file

◆ ~FileOut()

virtual FileOut::~FileOut ( )
virtual

Destructor.

Close the output file (using the system call close())

Member Function Documentation

◆ count()

static int FileOut::count ( )
static

Number of output files which are currently opened (with this class)

Returns
Number of active files

◆ flush()

virtual void FileOut::flush ( )
overridevirtual

Write the string to the open file.

The implementation should only use the system calls write() and fsync().

Implements OutputStream.

◆ getPath()

const char * FileOut::getPath ( )

Get path of the output file.

Returns
Path to output file (as defined in constructor)

The documentation for this class was generated from the following file: