![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| signals related question | ninjanesto | High Level Programming | 2 | 02-13-2007 10:43 AM |
| UNIX newbie NEWBIE question! | Hanamachi | UNIX for Dummies Questions & Answers | 3 | 09-14-2006 07:23 AM |
| Signals in Unix Solaris | heljy | High Level Programming | 1 | 03-24-2002 10:25 PM |
| linux newbie question... | Corey | UNIX for Dummies Questions & Answers | 5 | 02-10-2002 01:31 PM |
| Newbie question about unix flavours | Balaji | UNIX for Dummies Questions & Answers | 3 | 11-27-2000 09:12 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Unix/Linux Newbie(ish) Question - IPC/Signals - EDITED, OOPS!
The error i get says that SIGPIPE and SIG_IGN are undeclared. I think that these are defined in signum.h but am not sure and I can't check as nothing seems to be working at the mo (Triple booting with a couple of Win OS' = Grief). Please can somebody offer me some guidance, you all seem fairly knowledgeable. Apologies if this is all a bit Newbie or i'm being dense, it's all a bit strange. EDIT- I have put normal brackets instead of the proper ones around my #include's so that they will display. #include (stdio.h) #include (stdlib.h) #include (sys/stat.h) #include (unistd.h) #define FIFO_FILE "MYFIFO" #define FIFO_FILE2 "MYFIFO2" #define MAXNUM 8 int main(void) { FILE *fp; FILE *fp2; int i = 1; /* counters */ int j = 1; int count = 0; int array[10]; /* array to hold converted numbers */ signal(SIGPIPE, SIG_IGN);/* tell kernel to ignore a broken pipe */ /* Create the FIFO's if they do not exist */ mknod(FIFO_FILE, S_IFIFO|0666, 0); mknod(FIFO_FILE2, S_IFIFO|0666, 0); while(1) { /* Open the FIFO's here */ fp = fopen(FIFO_FILE, "r"); fp2 = fopen(FIFO_FILE2, "w"); /* Read in the array sent from Detector */ fread(array, sizeof(array), 1, fp); /* here we cheek the values of the array. If equal 2 write to the out FIFO so that it can be read by display */ count = 0; for (j=0; j < 9; j++) { if(array[j] > MAXNUM) count++; else count = 0; } if(count == 2) { fwrite(array, sizeof(array), 1, fp2); fwrite(NULL, 0, 1, fp2); } fclose(fp); fclose(fp2); } return(0); } I don't want to sound rude but help other than 'go find X book' would be preferable as I would rather not wait 2 weeks to get one ordered. Thank you kindly in advance[ Last edited by theultimatechuf; 01-19-2002 at 05:56 PM. |
| Forum Sponsor | ||
|
|