Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdio.h>
    int fgetpos( FILE *fp, fpos_t *pos );

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

Returns:
    The fgetpos function returns zero if successful, otherwise, the fgetpos
    function returns a non-zero value.  When an error has occurred,  errno
    contains a value indicating the type of error that has been detected.

Example:
    #include <stdio.h>

    void main()
      {
        FILE *fp;
        fpos_t position;
        auto char buffer[80];

        fp = fopen( "file", "r" );
        if( fp != NULL ) {
          fgetpos( fp, &position ); /* get position     */
          fgets( buffer, 80, fp );  /* read record      */
          fsetpos( fp, &position ); /* set position     */
          fgets( buffer, 80, fp );  /* read same record */
          fclose( fp );
        }
      }

Classification:
    ANSI

Systems:
    All, Netware

See Also:
    fopen, fseek, fsetpos, ftell

See Also: fseek fsetpos

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson