TBLT_RETC TBLT_ENTRY BltDataFlushHeader(TBLT_DH *dhPtr); dhPtr IO:data file control structureThis routine flushes the internal DBF header data to the DBF data file on disk and updates the directory entry for the correct size. If its .memoHandle indicates a memo file, the memo file is also flushed.
This routine is essential for multi-access use. It is used in conjunction
with the BltLock*()
routines. Before unlocking the data file
a call to this routine is necessary to ensure that the disk image is
up-to-date for the next access, which may be from anywhere not just your
program.
This routine is automatically called by BltUnlockDataRecord()
when unlocking a full-lock.
Any file that has been written to and had its size changed or its internal
representation changed will not have this change written to disk until a
flush is done, or the handle is closed. A flush can be performed after
every write action (BltDataAddRecord()
, for example), or not
until the handle is closed, or somewhere in between those two extremes, such
as when an idle period is detected. This is important also since this routine
tells the operating system to flush its buffers for this handle to disk, as well.
For a DBF flush, Bullet also calculates the true end-of-file location based on the number of records (TBLT_DH.noRecords), writing a 0x1A byte to that location and then truncating the file to that size.
Return: Non-zero indicates an error, otherwise the file's DBF (and DBT) header was
updated.