Wiki Page Content

Differences between revisions 1 and 2
Revision 1 as of 2010-07-15 00:50:49
Size: 690
Editor: SheenaSmith
Comment: create page, add content (Wed Mar 10 ver; changeset 4428) - incomplete
Revision 2 as of 2010-07-15 18:18:47
Size: 1451
Editor: SheenaSmith
Comment: add content from old wiki
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
value SDL_FunctionName(param) SDL_RWtell(ctx)
Line 15: Line 15:
<<Color2(green,Should there be anything to indicate a RV at the beginning of the syntax? Should the following be included in the syntax section?)>>

{{{(ctx)->seek(ctx, 0, RW_SEEK_CUR)}}}
Line 16: Line 20:
||'''param'''||description|| ||'''ctx'''||*a pointer to an SDL_RWops structure*||
Line 19: Line 23:
Returns the offset in the stream. *Returns the ^current^ offset in the stream.*
Line 22: Line 26:
*
Line 23: Line 28:
You can add your code example here #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);
}
Line 25: Line 46:
*
Line 27: Line 49:
''You can add useful comments here'' ,,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.
Line 30: Line 52:
 .[[SDL_OtherFunction]]  .[[SDL_RWFromFile]]???
 .[[SDL_RWSeek]]???
<<Color2(green,Should I list all the current read and write functions? Equivalent to SDL_RWclose?)>>
Line 33: Line 57:
[[CategoryAPI]], [[CategoryHeader]] [[CategoryAPI]], [[CategoryIO]]

DRAFT

SDL_RWtell

Use this function (macro) to *perform a do-nothing seek to get the current offset in an SDL_RWops stream*.

Syntax

SDL_RWtell(ctx)

green

(ctx)->seek(ctx, 0, RW_SEEK_CUR)

Function Parameters

ctx

*a pointer to an SDL_RWops structure*

Return Value

*Returns the current offset in the stream.*

Code Examples

*

#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);
}

*

Remarks

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.

green


CategoryAPI, CategoryIO

None: SDL_RWtell (last edited 2015-06-20 19:57:52 by PhilippWiesemann)

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