PTypes: streams: logfile

Top: Streams: logfile

>     #include <pstreams.h>

>     class logfile: outfile {
>         logfile( [ const string& filename, bool append = true ] );
>         void putf(const char* fmt, ...);
>     }

The lofgile class inherits all public methods and properties from outfile, but differs in the following:

- The append property is set to true by default.
- The buffer size is set to 0 by default.
- The logfile::putf() function is thread-safe: you can call this function for the same logfile object from concurrent threads.

logfile::logfile( [ const string& filename, bool append = true ] ) creates an output file stream, but does not open the file. When opening a file with open(), the file pointer is positioned at the end of the file, unless append is set to false. Filename and append parameters are optional.

void logfile::putf(const char* fmt, ...) is a thread-safe version of outstm::putf().

See also: iobase, outstm, outfile, Examples

PTypes home