SDL_RWtell

Name

SDL_RWtell -- Macro that returns the offset in an SDL_RWops stream

Synopsis

#include "SDL_rwops.h"

#define SDL_RWtell(ctx)                 (ctx)->seek(ctx, 0, RW_SEEK_CUR)

Description

SDL_RWtell is a macro that performs a do-nothing seek to get the current offset in an SDL_RWops stream. It takes one parameter, a pointer to an SDL_RWops structure.

Return Value

Returns the offset in the stream.

Note: This is not a built-in function. This is a macro that calls whatever seek function that happens to be pointed to in an SDL_RWops structure.

Example

#include <stdio.h>
#include "SDL_rwops.h"

int main()
{
  SDL_RWops *rw=SDL_RWFromFile("test.bin","r");
  if(rw==NULL)
  {
    fprintf(stderr,"Couldn't open test.bin\n");
    return(1);
  }

  SDL_RWseek(rw,0,RW_SEEK_END);
  fprintf(stderr,"Final position in test.bin: %d\n",SDL_RWtell(rw));
  SDL_RWclose(rw);
  return(0);
}

See Also

SDL_RWseek, SDL_RWread, SDL_RWwrite, SDL_RWclose, SDL_RWFromFile

SDL_RWtell (last edited 2009-10-23 11:45:38 by xdsl-78-35-130-139)