The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 04:58 AM
ls while read loop - internal read picking up wrong input dkieran Shell Programming and Scripting 2 05-14-2007 03:02 PM
Out put with select date. Help !!! sabercats Shell Programming and Scripting 4 02-27-2006 05:52 PM
how to select a value randomly norsk hedensk Shell Programming and Scripting 1 10-28-2003 05:39 PM
Multiple fds in select() amatsaka High Level Programming 1 11-13-2002 10:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-19-2002
jnuno jnuno is offline
Registered User
  
 

Join Date: Nov 2002
Posts: 4
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
  #2 (permalink)  
Old 11-19-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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().
  #3 (permalink)  
Old 11-19-2002
jnuno jnuno is offline
Registered User
  
 

Join Date: Nov 2002
Posts: 4
Thanks, I got it!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0