next up previous contents
Next: Reading and writing cyclic Up: The C API Previous: Creating a cyclic log   Contents

Opening and closing cyclic logs

The routine to open a cyclic log is CYC_open. The function prototype is:

CYC_fd* CYC_open(const char* filename, 
                 const char* openMode, 
                 CYC_ErrorCode* errorCode);
Permitted modes are:



Mode Description
r read
w write
a append
u synonym for append

The errorCode parameter is the address of an error code where the results of the error will be stored. The routine returns a null pointer in the event of an error.

Unlike other open routines, this open routine requires that the file already exists. If an attempt is made to open a non-existent logfile for writing or appending then an error will occur. This is because the logfile attributes (e.g size) need to be set upon creation. There is no provision for such attribute arguments in the open function.

The routine to close a cyclic log is CYC_close. The function prototype is:

void CYC_close(CYC_fd* fd);
The specified file descriptor must refer to an open cyclic log.


next up previous contents
Next: Reading and writing cyclic Up: The C API Previous: Creating a cyclic log   Contents
Andrew Marlow 2004-01-01