[Previous]
[Contents]
[Next]

rewind()

set the file position indicator to the beginning of the file

Synopsis:

#include <stdio.h>
void rewind( FILE *fp );

Description:

The rewind() function sets the file position indicator for the stream indicated by fp to the beginning of the file. It's equivalent to:

    fseek( fp, 0L, SEEK_SET );

except that the error indicator for the stream is cleared.

Examples:

#include <stdio.h>

static assemble_pass( int passno )
  {
    printf( "Pass %d\n", passno );
  }

void main()
  {
    FILE *fp;

    if( (fp = fopen( "program.asm", "r")) != NULL ) {
    assemble_pass( 1 );
    rewind( fp );
    assemble_pass( 2 );
    fclose( fp );
    }
  }

Classification:

ANSI

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

fopen(), clearerr()


[Previous]
[Contents]
[Next]