return value of successful open call

P

paresh

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
 
S

santosh

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>
 
K

Keith Thompson

paresh said:
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>
 
R

Richard Bos

paresh said:
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
 
R

Richard Tobin

paresh said:
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
 
C

CBFalconer

Richard said:
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.
 
B

Barry Schwarz

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top