lq-text: LQT_ReadBlock

API unsigned char * LQT_ReadBlock (db, Offset, WID) t_LQTEXT_Database *db; unsigned long Offset; t_WID WID;

Purpose

Reads the block at the given byte offset, and returns a pointer to the data. The data is stored in a cache, so it is important not to try and write beyond the end of the block or group of blocks as determined by LQT_Extend­Block or LQT_Find­Free­Block. The block must be written out with LQT_Write­Block if it has changed. In addition, the block is not locked in memory, but LQT_Read­Block ensures that it is safe to read at least one other block before writing this one out with LQT_Write­Block.

Returns

A pointer to the data

Errors

Fatal error (E_BUG) if the database can't be opened or created.

See Also:

Notes

Attempts to read beyond the end of the data file will extend the database automatically. The data will be initialised to zero, except for the block headers, whose NumberOfBlocks field will all be set to one.