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++ Language Reference - rewind http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   rewind

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

   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>
   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);
   }


See Also: fseek

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