Rewind (C)

From Wikipedia, the free encyclopedia

The correct title of this article is rewind (C). The initial letter is shown capitalized due to technical restrictions.

rewind is part of stdio.h in the C standard library. It sets the file pointer associated with the stream to the beginning of the file.

Prototype:

void rewind ( FILE * stream );

A call to rewind is equivalent to:

fseek ( stream , 0L , SEEK_SET );

except that unlike fseek, using rewind the error indicator is cleared.

The next operation with the stream after a call to fseek can be either for input or output. This function is also useful for clearing the keyboard buffer (normally associated with stdin).