return value of successful open call

Discussion in 'C Programming' started by paresh, Nov 5, 2007.

  1. paresh

    paresh Guest

    Return value of successful open call is non negative integer. Thats
    mean zero can be file descriptor. Is this a special
    file descriptor or zero can be a file descriptor for a regular file.

    Can someone highlight on this.

    Regards,
    Paresh
    paresh, Nov 5, 2007
    #1
    1. Advertising

  2. paresh

    santosh Guest

    On Monday 05 Nov 2007 1:17 pm paresh wrote in
    <>:

    > Return value of successful open call is non negative integer. Thats
    > mean zero can be file descriptor. Is this a special
    > file descriptor or zero can be a file descriptor for a regular file.
    >
    > Can someone highlight on this.


    open is a UNIX function. Therefore post to <news:comp.unix.programmer>
    santosh, Nov 5, 2007
    #2
    1. Advertising

  3. paresh <> writes:
    > Return value of successful open call is non negative integer. Thats
    > mean zero can be file descriptor. Is this a special
    > file descriptor or zero can be a file descriptor for a regular file.


    open() is not a standard C function. It's defined by POSIX, so you can
    ask about it in comp.unix.programmer. (fopen() is standard C; it
    returns a FILE* pointer, not an integer file descriptor.) <OT>File
    descriptor 0 is standard input.</OT>

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Looking for software development work in the San Diego area.
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Nov 5, 2007
    #3
  4. paresh

    MisterE Guest

    I believe the answer is yes it can have a descriptor zero.

    "paresh" <> wrote in message
    news:...
    > Return value of successful open call is non negative integer. Thats
    > mean zero can be file descriptor. Is this a special
    > file descriptor or zero can be a file descriptor for a regular file.
    >
    > Can someone highlight on this.
    >
    > Regards,
    > Paresh
    >
    MisterE, Nov 5, 2007
    #4
  5. paresh

    Richard Bos Guest

    paresh <> wrote:

    > Return value of successful open call is non negative integer. Thats
    > mean zero can be file descriptor. Is this a special
    > file descriptor or zero can be a file descriptor for a regular file.


    An open call of what? A function? Which function?

    *Light dawns* Oh, you mean a call _of_ open()! That's not an ISO C
    function, and therefore, as far as this group is concerned, it could
    return anything. You should ask this question in a group where your
    version of open() (and AIUI, yes, there are subtly different versions of
    that function) is on topic; that would probably be either
    comp.unix.programmer or microsoft.programming.<something>.

    Richard
    Richard Bos, Nov 5, 2007
    #5
  6. In article <>,
    paresh <> wrote:

    >Return value of successful open call is non negative integer. Thats
    >mean zero can be file descriptor. Is this a special
    >file descriptor or zero can be a file descriptor for a regular file.


    Zero is the file descriptor of standard input. It won't be returned
    by open() unless standard input has been closed (open() always returns
    the lowest available file descriptor). For more details, try a unix
    group.

    -- Richard
    --
    "Consideration shall be given to the need for as many as 32 characters
    in some alphabets" - X3.4, 1963.
    Richard Tobin, Nov 5, 2007
    #6
  7. paresh

    CBFalconer Guest

    Richard Tobin wrote:
    > paresh <> wrote:
    >
    >> Return value of successful open call is non negative integer.
    >> Thats mean zero can be file descriptor. Is this a special
    >> file descriptor or zero can be a file descriptor for a regular
    >> file.

    >
    > Zero is the file descriptor of standard input. It won't be
    > returned by open() unless standard input has been closed (open()
    > always returns the lowest available file descriptor). For more
    > details, try a unix group.


    And there is no reason, in standard C, to assume that "open()" has
    anything whatsoever to do with files. Conceded, L/Unix systems are
    common, so you have a fair chance of being right. But you are much
    safer in simply redirecting the enquiry, and stating why it is
    off-topic here.

    --
    Chuck F (cbfalconer at maineline dot net)
    <http://cbfalconer.home.att.net>
    Try the download section.



    --
    Posted via a free Usenet account from http://www.teranews.com
    CBFalconer, Nov 5, 2007
    #7
  8. On Mon, 05 Nov 2007 07:47:29 -0000, paresh <>
    wrote:

    >Return value of successful open call is non negative integer. Thats
    >mean zero can be file descriptor. Is this a special
    >file descriptor or zero can be a file descriptor for a regular file.
    >
    >Can someone highlight on this.


    The standard library does not have a function named open. You might
    have better luck in a newsgroup where it is topical, such as one that
    deals with unix.


    Remove del for email
    Barry Schwarz, Nov 6, 2007
    #8
    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. walala
    Replies:
    4
    Views:
    2,084
    Ralf Hildebrandt
    Sep 8, 2003
  2. Mike Lavender

    Successful Download Tracking

    Mike Lavender, Dec 2, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    407
    Bruce Johnson
    Dec 2, 2003
  3. Colum
    Replies:
    1
    Views:
    406
    Moonlit
    Dec 18, 2003
  4. Greenhorn
    Replies:
    15
    Views:
    801
    Keith Thompson
    Mar 6, 2005
  5. Raymond O'Connor
    Replies:
    1
    Views:
    139
    Raymond O'Connor
    Mar 8, 2007
Loading...

Share This Page