C/stdio.h/fsetpos — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Версия 14:20, 25 мая 2010

fsetpos: moves the file position pointer which is from fgetpos()

    
//Header file:     #include <stdio.h>  
//Declaration:     int fsetpos(FILE *stream, const 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);
      fsetpos(fp, &file_loc);
     
      fclose(fp);
  }