SDL_RWFromFP -- opens a file from a stdio file pointer.
#include "SDL.h" SDL_RWops *SDL_RWFromFP(FILE *fp, int autoclose);
SDL_RWFromFP creates a new SDL_RWops structure from a file pointer, opened with stdio. If autoclose is nonzero, the file will be automatically closed when the RWops structure is closed.
Note: This is not available under Win32, since files opened in an application on that platform cannot be used by a dynamically linked library.
Note: This function is not present in SDL-1.2-svn4446
Returns pointer to a new RWops structure, or NULL if it fails.
FILE *fp; SDL_RWops *rw; fp = fopen("myfile.dat", "rb"); rw = SDL_RWFromFP(fp, 1); // Do things with rw... SDL_RWclose(rw); // Automatically does an fclose(fp)