Prefer fgetpos()/fsetpos() over ftell() and fseek()

Home Forums C-programming.. Prefer fgetpos()/fsetpos() over ftell() and fseek()

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #2337 Reply
    Humble
    Keymaster

    The fgetpos() and fsetpos() functions are alternate interfaces equivalent to ftell() and fseek() (with whence set to SEEK_SET), setting and
    storing the current value of the file offset into or from the object referenced by pos. On some non-UNIX systems, an fpos_t object may be
    a complex object and these routines may be the only way to portably reposition a text stream.

    The offset returned from ftell and fseek are of type long int, so its bound to the limit of long int.

    fgetpos and fsetpos functions use a special typedef called fpos_t, to represent the offsets. This typedef can represent arbitrarily large offsets. In effect fgetpos and fsetpos can be used with arbitrarily huge files, not only that it also record the state associated with multibyte streams.

Viewing 1 post (of 1 total)
Reply To: Prefer fgetpos()/fsetpos() over ftell() and fseek()
Your information: