The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to select Shell mvictorvijayan Shell Programming and Scripting 2 09-12-2007 01:58 AM
ls while read loop - internal read picking up wrong input dkieran Shell Programming and Scripting 2 05-14-2007 12:02 PM
Out put with select date. Help !!! sabercats Shell Programming and Scripting 4 02-27-2006 01:52 PM
how to select a value randomly norsk hedensk Shell Programming and Scripting 1 10-28-2003 01:39 PM
Multiple fds in select() amatsaka High Level Programming 1 11-13-2002 06:10 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-19-2002
Registered User
 

Join Date: Nov 2002
Posts: 4
Stumble this Post!
Question select() and read()

Hi,

Could you please tell me how can I know which position a given read descriptor ocuppies in the descriptors table.

I know that, for instance, 'stdin' ocuppies position [0]... what about the others descriptors that I create usings pipes or sockets??

Thanks!

P.S.: Sorry for my bad English
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-19-2002
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,425
Stumble this Post!
pipe() returns an array with two file descriptors. socket() returns a single file descriptor. When you say that stdin is 0, that means that it is file descriptor 0. All of the system calls in sector 2 of the manual deal with file descriptors.

If you do an fopen(), on the other hand, you do not get a file descriptor, you get a pointer to a FILE structure. To convert that into an fd, just use fileno().
Reply With Quote
  #3 (permalink)  
Old 11-19-2002
Registered User
 

Join Date: Nov 2002
Posts: 4
Stumble this Post!
Thanks, I got it!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:22 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0