C Language: fgetpos function(Get File Position)

In the C Programming Language, the fgetpos function stores the current position of stream into the object pointed to by pos.


The syntax for the fgetpos function in the C Language is:

int fgetpos(FILE *stream, fpos_t *pos);

Parameters or Arguments


The stream whose current position is to be determined.


The current position of stream to be stored.


The fgetpos function returns zero if successful. If an error occurs, the fgetpos function will return a nonzero value and update errno.

Required Header

In the C Language, the required header for the fgetpos function is:

#include <stdio.h&ht;

Applies To

In the C Language, the fgetpos function can be used in the following versions:

  • ANSI/ISO 9899-1990

stdio.h Functions