void * LoadFile (char *fileName, long *fileSizePtr, uint32 memTypeBits)
Note that the buffer is allocated to an even multiple of the device's blocksize (2 KB for CD-ROM and the Mac link), and thus may be slightly larger than the actual size of the file. The file size returned via fileSizePtr, however, reflects the actual size of the file without the extra padding required to achieve an integral device block size.
This function is approximately 3-4 times as fast as the old method of loading a file using GetFileSize()
, allocating a buffer, calling ReadFile()
. When you are finished with the file, use UnloadFile()
to free the file buffer.
If an error returns, the function return value is NULL and the longword at the *fileSizePtr contains the error status. A return value of NULL with an error status of zero indicates that the file exists but contains no data; in this cas, no buffer was allocated.
UnloadFile
, LoadFileHere, AsyncLoadFile