Xiqual 0.9.1

In file include/files.h:

typedef struct autofile

Autofile structure.

[more]size_t size
Size of file.
[more]size_t pos
Current position in an open file.
[more]size_t read
Number of bytes read in last read operation.
[more]char* name
Name of file.
[more]char* buf
A buffer used in file_read() operations.
[more]size_t bufsize
Size of buf element.
[more]FILE* f
The actual FILE pointer.
[more]void (*readhook)(char* buf, size_t len)
Hook called when reading.



Documentation

Autofile structure. Use file_new() to create a structure with a filename. The other file_* operations can be used to read, write and seek in the file.
osize_t size
Size of file. Writing operations will add the number of bytes written from each call.

osize_t pos
Current position in an open file. This usually equals size with a file being written to.

osize_t read
Number of bytes read in last read operation. The pos element will point to the point after last byte read. Start point of the last read chunk of data is pos - read.

ochar* name
Name of file. No special checking is made on this name to ensure it is valid for the OS to create.

ochar* buf
A buffer used in file_read() operations. You must create this buffer with file_initbuf(). The buffersize shouldn't need to be larger than the size of a file.

osize_t bufsize
Size of buf element. file_read() will not read more than this much per call. The previous buffer contents are of course lost. No special care is made to clear the contents before reading, so do not expect everything to be nicely NULL-terminated.

oFILE* f
The actual FILE pointer. For internal use.

ovoid (*readhook)(char* buf, size_t len)
Hook called when reading. This is called right after reading in all data and ensuring anything was read. See md5.c in the base Xiqual directory for an example of simple usage of a hook.
Author:
Ronny Bangsund
See Also:
file_new(), file_free(), file_getsize(), file_initbuf(), file_load(), file_seek(), file_scan(), file_read(), file_write(), file_readhook(), file_writehook()

Alphabetic index



This page was generated with the help of DOC++.