set the file position indicator to the beginning of the file
#include <stdio.h> void rewind( FILE *fp );
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.
#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 ); } }
ANSI
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |