====== hfzLoadEx ======
===== Description =====
Load a HF2/HFZ file from disk into memory. Unlike [[libhfz:functions:hfzLoad]], this function automatically allocates the memory block.
===== Function prototype =====
long hfzLoadEx(const char* lpFileName, hfzHeader& fh, float** h_pData, LIBHFZ_PROG_CALLBACK lpProgCallback, void* lpCallbackParam);
===== Arguments =====
^ Name ^ Type ^ Description ^
| lpFileName | const char* | The file name of the file to be loaded. |
| fh | hfzHeader& | The hfzHeader struct to be read from the file. |
| h_pData | float** | A handle to the to the float* that will be initialised as the map memory block. |
| lpProgCallback | LIBHFZ_PROG_CALLBACK | A handle to a callback function for displaying progress (see comments below). May be NULL if no callback is desired. |
| lpCallbackParam | void* | A handle to a user-defined parameter to be passed back to the //lpProgCallback// function, if used. |
===== Return value =====
LIBHFZ_STATUS_OK if the file was loaded successfully, and otherwise an error code. Use [[libhfz:functions:hfzGetErrorStr]] to retrieve the error description.
===== Example =====
hfzHeader fh; // declare a header struct
float* pData; // declare a map data handle
hfzLoadEx("mymap.hfz", fh, &pData, 0); // load the file
===== Comments =====
==== Callers must free data ====
Once you are finished with the map data addressed by //h_pData//, you must release the memory using the ''free'' function. Otherwise memory will leak.
==== Using lpProgCallback ====
Please consult the comments for [[libhfz:functions:hfzsave#Using lpProgCallback|hfzSave]]