By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,767 Members | 1,080 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,767 IT Pros & Developers. It's quick & easy.

problems with select ( ) function

P: 1
Hi,

I am new to linux programming. I am using c to develop a program that aims to create many children in order to communicate with their parents through pipes

I need the parent to wait for all the children to finish processing and write to their parent using the appropriate pipe for each children. I know that I may use the select function for this purpose and I have read a lot about it but I don't know how to use it in my program

code skeleton can be like this

int main(int argc,char *argv[])
{
fd_set rfds;
int i;
int fd[2];
FD_ZERO(&rfds);

for(i=0;i<atoi(argv[1]);i++)
{
pipe(fd);
if(!fork())
//child process and write to the parent then exit
else
//i want the select function to be here
}
return 0;
}
Sep 15 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.