void rewind ( FILE * stream );
Repositions the file pointer to the beginning of a stream.
Sets the file pointer associated with the stream to the beginning of the file.
A call to rewind is equivalent to:
fseek ( stream , 0L , SEEK_SET );
except that unlike fseek, using rewind the error indicator is cleared.
The next operation with the stream after a call to fseek can be either for input or output.
This function is also useful for clearing the keyboard buffer (normally associated with stdin).
Defined in ANSI-C.
/* rewind example */
FILE * pFile;
char buffer ;
pFile = fopen ("myfile.txt","w+");
for ( n='A' ; n<='Z' ; n++)
fputc ( n, pFile);
A file called myfile.txt is created for reading and writing
and filled with the alphabet.
The file is rewinded, read and its content is stored in
a buffer, that then is written to the standard output