HGE::Resource_Load

Loads a resource into memory from resource pack or disk file.

void *Resource_Load(
  const char *filename,
  DWORD *size = 0
);

Parameters

filename
Resource file name.
size
Pointer to a DWORD to store the resource size to. If = 0 or omitted, Resource_Load will not return the resource size.

Return value

If successful, returns pointer to a memory allocated for the resource and stores resource size to a DWORD addressed by size parameter. Otherwise returns 0.

Remarks

If filename specifies relative path, resource file is first searched within all resource packs attached with Resource_AttachPack, then in the application disk folder. If filename specifies absolute disk path, resource file is loaded directly from disk.

If the function fails, you may obtain error message with System_GetErrorMessage function. Also if HGE_LOGFILE system state was set, the error message is written to log.

When the resource isn't needed longer, you must free the allocated memory with the Resource_Free call.

Requirements

Header: hge.h
Import library: hge.lib

See also

Resource_Free