Code Snippets C

//Header file: #include
//Declaration: void rewind(FILE *stream);
#include
#include
int main(int argc, char *argv[])
{
FILE *filep;
if((filep=fopen("test", "r"))==NULL) {
printf("Cannot open file.\n");
exit(1);
}
while(!feof(filep)){
putchar(getc(filep));
}
rewind(filep);
while(!feof(filep)){
putchar(getc(filep));
}
fclose(filep);
}