rewind

Sets the file position indicator to the beginning of the file.

Library:LibC
Classification:ANSI
Service:File and Directory I/O

Syntax

  #include <stdio.h> 
   
  void rewind (
     FILE   *fp);
  

Parameters

fp

(IN) Points to the file.

Remarks

The rewind function sets the file position indicator for the stream indicated by fp to the beginning of the file. It is equivalent to the following:

     fseek( fp, 0L, SEEK_SET );
  

except that the error indicator for the stream is cleared.

If you want to determine if rewind encounters an error, clear errno and then call rewind. If errno is nonzero, assume an error has occurred.

See Also