codescracker


c

C rewind()



« Previous Function Next Function »


rewind()

The rewind() function moves the file position indicator to the start of the specified stream. It also clears the end-of-file and error flags associated with stream

rewind() Syntax

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

rewind() Example

Following function twice reads the stream pointed to by fp, displaying the file each time:

void re_read(FILE *fp)
{
	/* read once */
	while(!feof(fp))
	putchar(getc(fp));

	rewind(fp);
	
	/* read twice */
	while(!feof(fp))
	putchar(getc(fp));
}

« Previous Function Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test