next up previous contents
Next: Error handling Up: The C API Previous: Opening and closing cyclic   Contents

Reading and writing cyclic logs

A cyclic log file descriptor is needed for the read and write functions. This descriptor is the return value from the CYC_open function.

To read a maximum of buflen bytes into buffer, use the CYC_read routine:

int CYC_read(CYC_fd* fd, char* buffer, int buflen);
The return value is -1 on error, otherwise it is the number of bytes read. A return value of zero indicates end of file.

To write buflen bytes of data from buffer, use the CYC_write function:

int CYC_write(CYC_fd* fd, const char* buffer, int buflen);
The return value is -1 on error, otherwise it is the number of bytes written.



Andrew Marlow 2004-01-01