C/stdio.h/fgetpos

Материал из C\C++ эксперт
Перейти к: навигация, поиск

fgetpos: stores the current file position indicator

<source lang="cpp">

//Header: #include <stdio.h> //Declaration: int fgetpos(FILE *stream, fpos_t *position); //Return: returns zero on success or nonzero on failure

 #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);
 }
          
      </source>