C Tutorial/stdio.h/fgetpos


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Перейти к: навигация, поиск

fgetpos

Item Value Header

  1. include <stdio.h>

Declaration int fgetpos(FILE *stream, fpos_t *position); Function stores the current file position indicator. Return returns 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);
  }