Returns the number of objects read, or 0 at error or end of file; call
SDL_GetError()
for more information.
You should not use the results of
SDL_GetError()
to decide if an error has occurred!
Then how should I decide if an error has occured?
Returns the number of objects read, or 0 at error or end of file; call
SDL_GetError()
for more information.
You should not use the results of
SDL_GetError()
to decide if an error has occurred!
Then how should I decide if an error has occured?
In this specific case you should use SDL_GetError()
. The general guidance means not to use it alone to decide if an error has occurred, but in the case of SDL_RWread()
etc. you have already been notified that either an error or an end-of-file condition has occurred, so it’s OK to use SDL_GetError
to distinguish between them.