rewind
From cppreference.com
C
Concurrency support (C11)
File input/output
Types and objects
Functions
File access
Unformatted input/output
(C95)(C95)
(C95)
(C95)(C95)
(C95)
(C95)
(C95)
(C95)
Formatted input
(C11)(C11)(C11)
(C95)(C95)(C95)(C11)(C11)(C11)
(C99)(C99)(C99)(C11)(C11)(C11)
(C99)(C99)(C99)(C11)(C11)(C11)
Direct input/output
Formatted output
(C99)(C11)(C11)(C11)(C11)
(C95)(C95)(C95)(C11)(C11)(C11)(C11)
(C99)(C11)(C11)(C11)(C11)
(C95)(C95)(C95)(C11)(C11)(C11)(C11)
File positioning
Error handling
Operations on files
(C11)
(C11)
Defined in header
<stdio.h>
void rewind( FILE *stream );
Moves the file position indicator to the beginning of the given file stream.
The function is equivalent to fseek (stream, 0, SEEK_SET );, except that end-of-file and error indicators are cleared.
The function drops any effects from previous calls to ungetc .
[edit] Parameters
stream
-
file stream to modify
[edit] Return value
(none)
[edit] Example
This example shows how to read a file twice
Run this code
Output:
0123456789 0123456789
[edit] References
- C11 standard (ISO/IEC 9899:2011):
- 7.21.9.5 The rewind function (p: 338)
- C99 standard (ISO/IEC 9899:1999):
- 7.19.9.5 The rewind function (p: 304)
- C89/C90 standard (ISO/IEC 9899:1990):
- 4.9.9.5 The rewind function
[edit] See also
C++ documentation for rewind