Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>rewind</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
rewind

Usage

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

   ANSI

Description

   rewind repositions the file pointer associated with a stream to the
   beginning of the file. This is equivalent to using
   fseek(fp,0L,SEEK_SET),with the error flag for fp also cleared.

Example 

   #include <stdio.h>
   #include <stdlib.h>

   int main()
   {
       FILE *fp;
       char *string = "String one, example string";
       char string2[30] = "xxxxxxxxxxxxxx";
       fp = fopen("file.dat","w+");
       fprintf(fp,"%s",string);

       rewind(fp);
       fscanf(fp,"%s",string2);
       printf("The value read back is: %s\n",string2);
       return EXIT_SUCCESS;
   }

See Also

   fseek



See Also: fseek

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson