Wiki Page Content

Differences between revisions 11 and 12
Revision 11 as of 2015-04-26 19:12:59
Size: 1459
Comment: Sorted related functions, see SGFunctions.
Revision 12 as of 2015-04-26 19:31:26
Size: 1465
Comment: Added missing ().
Deletions are marked like this. Additions are marked like this.
Line 32: Line 32:
SDL_RWclose closes and cleans up the SDL_RWops stream. It releases any resources used by the stream and frees the SDL_RWops itself with [[SDL_FreeRW]]. This returns 0 on success, or -1 if the stream failed to flush to its output (e.g. to disk). SDL_RWclose() closes and cleans up the SDL_RWops stream. It releases any resources used by the stream and frees the SDL_RWops itself with [[SDL_FreeRW]](). This returns 0 on success, or -1 if the stream failed to flush to its output (e.g. to disk).
Line 36: Line 36:
SDL_RWclose is actually a macro that calls the SDL_RWops's '''close''' method appropriately, to simplify application development. SDL_RWclose() is actually a macro that calls the SDL_RWops's '''close''' method appropriately, to simplify application development.

SDL_RWclose

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

Syntax

int SDL_RWclose(struct SDL_RWops* context)

Function Parameters

context

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

Uint8 buf[256];
SDL_RWops *rw = SDL_RWFromFile("test.bin", "r");
if (rw != NULL) {
    SDL_RWread(rw, buf, sizeof (buf), 1);
    SDL_RWclose(rw);
}
// Go on and use the data in buf...

Remarks

SDL_RWclose() closes and cleans up the SDL_RWops stream. It releases any resources used by the stream and frees the SDL_RWops itself with SDL_FreeRW(). This returns 0 on success, or -1 if the stream failed to flush to its output (e.g. to disk).

Note that if this fails to flush the stream to disk, this function reports an error, but the SDL_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)

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