fgetpos : fgetpos « stdio.h « C Tutorial






ItemValue
Header#include
Declarationint fgetpos(FILE *stream, fpos_t *position);
Functionstores the current file position indicator.
Returnreturns zero on success or nonzero on failure


'fpos_t *position' is useful only in a call to fsetpos().

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

  int main(int argc, char *argv[])
  {
      FILE *fp;
      fpos_t file_loc;

      if((fp=fopen("test","r"))==NULL) {
          printf("Cannot open file.\n");
          exit(1);
      }
   
      fgetpos(fp, &file_loc);

      fclose(fp);
  }








22.7.fgetpos
22.7.1.fgetpos