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

Usage

   #include <stdio.h>
   int fgetpos(FILE *fp, fpos_t pos);

Description

   The function fgetpos gets the current position of the stream fp. The
   position is stored in pos. The format of fpos_t is internal, the value in
   pos can be used to reset the position of the stream pointer later using
   fsetpos.

Example 

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

   int main()
   {
       FILE *fp;
       fpos_t pos;

       char dump[64];

       fp = fopen("temp.fil","rb");
       fread(dump,1,64,fp);

       /* Save current position */
       if (fgetpos(fp,pos) != 0) {
           perror("fgetpos failed");
           return EXIT_FAILURE;
       }
       fread(dump,1,64,fp);

       /* back to previous position */
       if (fsetpos(fp,pos) != 0) {
           perror("fsetpos failed");
           return EXIT_FAILURE;
       }
       return EXIT_SUCCESS;
   }

Return Value

   0 if successful, otherwise non-zero and errno is set.

See Also

   fsetpos



See Also: fsetpos

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