void * LoadFileHere (char *fname, int32 *pfsize, void *buffer, int32 bufsize)
LoadFile()
except that it lets you allocate the buffer. If the bufsize parameter is non-zero, this function checks to ensure that the file will fit in the specified buffer. The actual size of the file, which may be smaller than the buffer, is stored at *pfsize. If an error occurs the word at *pfsize will contain a negative error code. When allocating a buffer, remember that the buffer has to be an integral multiple of the file device's blocksize.That is, loading a 700 byte file from a CD still requires a 2k buffer. A useful space-saving technique involves loading a small file into the inactive screen buffer in VRAM then copying it (or perhaps just a small portion of it that you need) to a right-sized buffer elsewhere in memory.
LoadFile
,
AsyncLoadFile