Lseek Error

Discussion in 'C Programming' started by pavunkumar, Mar 31, 2009.

  1. pavunkumar

    pavunkumar Guest

    Dear Friend :

    I have doubt about lseek error. Actually it will
    come whenever we are using undefine memory . But I dont know it will
    exactly affect the program . Can you any one explain..... ?

    Thanks,,,
     
    pavunkumar, Mar 31, 2009
    #1
    1. Advertising

  2. pavunkumar

    James Kuyper Guest

    pavunkumar wrote:
    > Dear Friend :
    >
    > I have doubt about lseek error. Actually it will
    > come whenever we are using undefine memory . But I dont know it will
    > exactly affect the program . Can you any one explain..... ?


    lseek() is not a C standard library function. According to the man page
    on my home computer, it is

    > CONFORMING TO
    > SVr4, 4.3BSD, POSIX.1-2001.


    Assuming that my man page describes the same function you're talking
    about, the more appropriate place to ask about it is comp.programming.unix.

    I'm not sure what you mean when you talk about "using undefined memory".
    According to that man page, lseek takes three arguments, none of which
    is a pointer to memory. If any of the those arguments was extracted from
    memory that has not been initialized, then the behavior of your program
    is undefined before it even calls lseek(). The way in which this will
    "affect the program" is to make the behavior of the program completely
    unpredictable.

    If that is not what you're referring to when you talk about "using
    undefine memory", then when you re-post this inquiry to
    comp.programming.unix, you should explain more precisely what it is you
    are talking about.

    An lseek error will leave errno with one of the following values:

    > EBADF fildes is not an open file descriptor.
    >
    > EINVAL whence is not one of SEEK_SET, SEEK_CUR, SEEK_END; or the
    > resulting file offset would be negative, or beyond the end of a
    > seekable device.
    >
    > EOVERFLOW
    > The resulting file offset cannot be represented in an off_t.
    >
    > ESPIPE fildes is associated with a pipe, socket, or FIFO.
     
    James Kuyper, Mar 31, 2009
    #2
    1. Advertising

  3. pavunkumar

    Rob Clarke Guest

    pavunkumar scribbles:
    > Dear Friend :
    >
    > I have doubt about lseek error. Actually it will
    > come whenever we are using undefine memory . But I dont know it will
    > exactly affect the program . Can you any one explain..... ?
    >
    > Thanks,,,


    Errr, what? Probably the better newsgroup is comp.unix.programmer.
    But reword that before posting there!

    Rob
     
    Rob Clarke, Mar 31, 2009
    #3
    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. Elephant

    Code for lseek

    Elephant, Jan 12, 2006, in forum: C Programming
    Replies:
    2
    Views:
    779
    Walter Roberson
    Jan 12, 2006
  2. venkat

    regarding lseek and fread

    venkat, May 27, 2007, in forum: C Programming
    Replies:
    2
    Views:
    442
    Martin Ambuhl
    May 27, 2007
  3. golden

    lseek and write question

    golden, Nov 16, 2007, in forum: C++
    Replies:
    3
    Views:
    589
    James Kanze
    Nov 17, 2007
  4. Gordon Beaton
    Replies:
    3
    Views:
    1,354
  5. Replies:
    3
    Views:
    130
    Andreas Perstinger
    May 14, 2013
Loading...

Share This Page