rewind

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)

Argument

file_ptr
A file pointer.

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 DEC 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 in this section.


Previous Page | Next Page | Table of Contents | Index