Use this function to create an SDL_RWops structure from a standard I/O file pointer (stdio.h's
void *fp, SDL_bool autoclose);SDL_RWops* SDL_RWFromFP(
Returns a pointer to the SDL_RWops structure that is created, or NULL on failure; call SDL_GetError() for more information.
This function is not available on Windows, since files opened in an application on that platform cannot be used by a dynamically linked library.
This function is available since SDL 3.0.0.
FILE *fp = fopen("myfile.dat", "rb"); SDL_RWops *rw = SDL_RWFromFP(fp, SDL_TRUE);/* Do things with rw... */ /* Automatically does an fclose(fp) in this case */SDL_RWclose(rw);