Hello, i have been given the following code to help me learn how to use signals, it won't compile. The problem maybe because this was written for use in Unix and i am trying to compile in Linux.
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.
#define FIFO_FILE "MYFIFO"
#define FIFO_FILE2 "MYFIFO2"
#define MAXNUM 8
int i = 1; /* counters */
int j = 1;
int count = 0;
int array; /* 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);
/* 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);
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[