DemoGL::Reference::Functions::DEMOGL_FileLoad

DEMOGL_FileLoad

DEMOGL_FileLoad loads the file specified into memory and returns a pointer to the filedata in memory.

byte
* DEMOGL_FileLoad(
	const char *pszFilename
);
	
Parameters.
pszFilename
Pointer to a zero-terminated string which represents the filename, inclusive subpaths, of the file you want to load.

Return values.
If the function succeeds, it returns a pointer of type byte * to the filedata in memory.
If the function fails, it returns NULL.

Remarks.
Because DemoGL does all the File I/O for you so it's completely transparant for you where the files come from (datafile or directory), and you are not bothered by the fact files have to be unpacked and/or decrypted. DEMOGL_FileLoad handles all that for you. If you don't need the data from the file anymore, call DEMOGL_FileFree to free the buffer, because otherwise your application leaks memory. If you want to know how big the buffer is in bytes, use DEMOGL_FileGetLength. Keep in mind that the filename pointed by pszFilename should contain C/C++ backslash escaping plus should contain the paths needed, thus starting from the root directory DemoGL expects the data, which can be a directory on disk or a datafile with subdirs.

Example.
byte	*pbyMyData

// Load some datafile.
pbyMyData = DEMOGL_FileLoad("data\\mydata.dat");

// Use data

// Free the data loaded
DEMOGL_FileFree(pbyMyData);
	

Requirements.
DemoGL v1.3 (build 0112 or higher)

See also.
DEMOGL_FileFree

Last changed on 20-jan-2001

©1999-2001 Solutions Design