// Interface to FileAccess
// Implementation is in FileAccess.cpp
#ifndef FILEACCESS_DECL
#define FILEACCESS_DECL true
#include <stdio.h>
// FileAccess class
class fileaccess
{
private:
FILE* fptr; // File pointer
HANDLE file_sema; // Semaphore to ensure mutually exclusive file access
config* settings; // Program settings
char filename[100]; // Filename of file
char type[2]; // Type of file access eg. "r", "w", etc.
bool always_flush; // Always flush file after writing to it (good for log files)
void writefooterstart( void ); // Write first part of footer
void writefooterend( void ); // Write last part of footer
public:
bool error; // Used to indicate an error opening the file
bool last_was_break; // Was the last thing written <BR>?
bool last_was_space; // Was the last thing read a space?
bool ignored_section; // Is this a section that should be ignored?
// Functions:
fileaccess(char*, char*, config*); // Constructor - open the file
~fileaccess(); // Destructor - close the file
void write( char* ); // Write data to file (overloaded)
void write( char ); // Write data to file (overloaded)
void write( char*, int ); // Write data to file (overloaded) - fixed width
char read( void ); // Read data from file
void writetime( void ); // Write time and date to file
void writeheaders(char*, char*); // Write HTML headers
void writefooters(char*); // Write HTML footers
void writeerrorfooters( void ); // Write HTML error footers
void alwaysflush( void ); // Set always flush to true
void lock( void ); // Locks file access to ensure mutual exclusion
void unlock( void ); // Unlocks file access to ensure mutual exclusion
};
#endif
syntax highlighted by Code2HTML, v. 0.8.11