Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/rewind.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/rewind.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/rewind.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/rewind.html on line 8
Rewind a file stream to the beginning of the file
#include <stdio.h>
void rewind( FILE *fp );
- fp
- The file stream that you want to rewind.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The rewind() function rewinds the file stream specified by
fp to the beginning of the file.
It's equivalent to calling
fseek() like this:
fseek( fp, 0L, SEEK_SET );
except that the error indicator for the stream is cleared.
This example shows how you might implement a two-pass assembler:
#include <stdio.h>
#include <stdlib.h>
void assemble_pass( FILE *fp, int passno )
{
printf( "Pass %d\n", passno );
/* Do more work on the fp */
switch( passno ) {
case 1:
/* do the first-pass work */
break;
case 2:
/* do the second-pass work */
break;
default:
break;
}
}
int main( void )
{
FILE *fp;
fp = fopen( "program.s", "r" );
if( fp != NULL ) {
assemble_pass( fp, 1 );
rewind( fp );
assemble_pass( fp, 2 );
fclose( fp );
return EXIT_SUCCESS;
}
puts( "Error opening program.s" );
return EXIT_FAILURE;
}
ANSI,
POSIX 1003.1
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
clearerr(),
fopen(),
fseek()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/rewind.html on line 162
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/rewind.html on line 162