Err AsyncLoadFile (char *fname, LoadFileInfo *lf)
The function opens the file, gets status information like filesize, then starts the I/O process. Upon successful return from this function you can refer to the buffer, bufSize, and bf (BlockFileInfo) fields of the LoadFileInfo structure, even while the I/O is still in progress. The contents of the buffer are, of course, indeterminate until the I/O process completes.
The LoadFileInfo structure is defined in blockfile.h. It contains values that control the load operation. If the buffer pointer in the structure is NULL, a buffer is allocated for you. If the buffer pointer is non-NULL, it is a pointer to a buffer you allocated for the file. If the ioDonePort value in the structure is non-zero, the I/O is set up to notify you via message when the load completes.
If you store a NULL buffer pointer into the LoadFileInfo structure and
allow this function to allocate a buffer for you, use the
UnloadFile()
function to release the buffer when you no
longer need its contents.
You must eventually follow a call to this function with a call to either
AbortAsyncLoadFile()
, WaitAsyncLoadFile()
, or
FinishAsyncLoadFile()
.
AbortAsyncLoadFile
,
LoadFile,
LoadFileHere,
UnloadFile