Wiki Page Content

Differences between revisions 8 and 9
Revision 8 as of 2013-10-31 21:14:11
Size: 1141
Comment: Added missing argument in example.
Revision 9 as of 2014-11-04 22:25:57
Size: 1149
Comment: Added spaces in example.
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:
SDL_RWops *rw = SDL_RWFromFile("test.bin","r");
if(rw != NULL) {
  extern Uint8 buf[256];
  SDL_RWread(rw, buf, sizeof (buf), 1);
SDL_RWops *rw = SDL_RWFromFile("test.bin", "r");
if (rw != NULL) {
   extern Uint8 buf[256];
   SDL_RWread(rw, buf, sizeof (buf), 1);



Use this function to close and free an allocated SDL_RWops structure.


int SDL_RWclose(struct SDL_RWops* context)

Function Parameters


SDL_RWops structure to close

Return Value

Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

Code Examples

SDL_RWops *rw = SDL_RWFromFile("test.bin", "r");
if (rw != NULL) {
    extern Uint8 buf[256];
    SDL_RWread(rw, buf, sizeof (buf), 1);


Note that if this fails to flush the stream to disk, this function reports an error, but the RWops is still invalid once this function returns.

SDL_RWclose is actually a macro that calls the SDL_RWops's close method appropriately, to simplify application development.

CategoryAPI, CategoryIO

None: SDL_RWclose (last edited 2015-06-20 19:55:24 by PhilippWiesemann)

Please include your contact information if you'd like to receive a reply.