![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Universal algorithms for channel decoding of uncompressed sources | iBot | UNIX and Linux RSS News | 0 | 02-22-2008 05:50 AM |
| Horizontal sorting of lines in a File: SED implementation? | marlonus999 | UNIX for Advanced & Expert Users | 7 | 03-19-2007 03:03 AM |
| need help with my implementation of cat in bash | sanchopansa | Shell Programming and Scripting | 4 | 10-18-2006 07:28 AM |
| Solaris Timer Implementation | ulisses0205 | High Level Programming | 2 | 04-06-2004 02:03 PM |
| Shell Implementation | clickonline1 | UNIX for Dummies Questions & Answers | 3 | 10-02-2001 05:52 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
im new to programming c in unix
this is program written by me i want each and every child to do a seperate work such implement a different sorting algorithm but im not getting the way i wrote as below...plz help me how can i do that #include<stdio.h> main() { int i; for(i=0;i<5;i++) { fork(); child(i); exit(0); } } child(int j) { switch(j) { case 0: printf("iam child1 %d\n",j); break; case 1: printf("iam child 2 %d\n",j); break; default: printf("iam other\n"); } return; } i want child 1 to execute case 1 child 2 to execute case 2....but all childs are executing only case 0 thank u Last edited by chaitu07; 03-03-2005 at 02:18 PM.. Reason: i have implemented as u said but im not getting |
|
||||
|
Seems you need to start several processes with different sorting methods.
If you need to compare times you can write separate programs and use 'time' for measuring their speed. But if you really need do start several functions in separate processes the you can use fork() inside loop. Parent will continue loop while child should break it. Read fork() manual. Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|