Loads a datafile into memory.


DATAFILE *load_datafile(const char *filename);
Loads a datafile into memory in one go. If the datafile has been encrypted, you must first call packfile_password() to set the appropriate key. If the datafile contains truecolor graphics, you must set the video mode or call set_color_conversion() before loading it. Example:
      /* Load the resources for our game. */
      DATAFILE *dat = load_datafile("game.dat");
      if (!dat)
	 abort_on_error("Couldn't load sound resources!");
      /* Use resources. */
      /* Destroy them when we don't need them any more. */
Returns a pointer to the DATAFILE, or NULL on error. Remember to free this DATAFILE later to avoid memory leaks.

Related Discussions

The following threads each have code containing this keyword: Note: You can click on the numbers to jump directly to the posts that reference this page.

Related Projects

The following projects include source code containing this keyword: