A call to rewind is equivalent to:
fseek ( stream , 0L , SEEK_SET );
except that, unlike fseek, rewind clears the error indicator.
On streams open for update (read+write), a call to rewind allows to switch between reading and writing.
Parameters
- stream
- Pointer to a FILE object that identifies the stream.
Return Value
noneExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
A file called myfile.txt is created for reading and writing and filled with the alphabet. The file is then rewinded, read and its content is stored in a buffer, that then is written to the standard output:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
See also
| fseek | Reposition stream position indicator (function) |
| fsetpos | Set position indicator of stream (function) |
| fflush | Flush stream (function) |
