Sets the file to its beginning. Format #include <stdio.h> void rewind (FILE *file_ptr); (ISO POSIX-1) int rewind (FILE *file_ptr); (DEC C Extension)
1 – Argument
file_ptr A file pointer.
2 – Description
The rewind function is equivalent to fseek (file_ptr, 0, SEEK_ SET). You can use the rewind function with either record or stream files. A successful call to rewind clears the error indicator for the file. The ANSI C standard defines rewind as not returning a value; therefore, the function prototype for rewind is declared with a return type of void. However, since a rewind can fail, and since previous versions of the C RTL have declared rewind to return an int, the code for rewind does return 0 on success and -1 on failure. See also fseek.