fgetpos

Stores the current position of a stream in an object

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

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

Parameters

fp
(IN) Points to the file.
pos
(OUT) Points to the object into which the position of the file is stored.

Return Values

The fgetpos function returns a value of 0 if successful. Otherwise, the fgetpos function returns a nonzero value. If an error occurs, errno is set.

Remarks

The fgetpos function stores the current position of the file pointed to by fp in the object pointed to by pos. The value stored is usable by the fsetpos function for repositioning the file to the position it had at the time of the call to fgetpos.

See Also

fopen, fseek, fsetpos, ftell

fgetpos Example

  #include <stdio.h> 
    
  main ()  
  {  
     int    completionCode;  
     FILE   *fp;  
     fpos_t position;  
     completionCode = fgetpos (fp, &position);  
     completionCode = fsetpos (fp, &position);  
  }