Test for seekability?

Discussion in 'C Programming' started by Steve, Oct 19, 2003.

  1. Steve

    Steve Guest

    It seems that the return values of fseek() and ftell() are undefined for
    non-seekable devices. So is there any way to test whether a stream is
    seekable?
    Steve, Oct 19, 2003
    #1
    1. Advertising

  2. Steve <> wrote:

    >It seems that the return values of fseek() and ftell() are undefined for
    >non-seekable devices. So is there any way to test whether a stream is
    >seekable?


    The return values of fseek and ftell are well defined:

    fseek() returns nonzero for a request that cannot be satisfied.

    ftell() function returns -1L on failure and stores an implementation-
    defined positive value in errno.

    You may use these to determine if you can set/get the file position
    indicator for a stream.

    Regards
    --
    Irrwahn
    ()
    Irrwahn Grausewitz, Oct 19, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sting
    Replies:
    5
    Views:
    1,605
    Natty Gur
    Jun 8, 2004
  2. Robert Allan Schwartz
    Replies:
    7
    Views:
    362
    Marco Manfredini
    Aug 13, 2004
  3. Chris
    Replies:
    1
    Views:
    658
    Chris
    May 11, 2006
  4. Edvard Majakari
    Replies:
    4
    Views:
    671
    Edvard Majakari
    Feb 25, 2005
  5. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    680
    Skybuck Flying
    Oct 4, 2009
Loading...

Share This Page