hello i have got little problem :)
create a c program which starts with 3 processes the first proccess generates 50 random numbers and writes them inti common memory. the second proccess reads them and whrites the even numbers in file A,the odd numbers in file B.
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int A;
srand(time(0));
for (A = 0; A < 50; ++A) {
int number;
number = rand();
printf("%d\n");
}
return 0;
}
i create first part of the program i also know how to find odd and even numbers
if ( x % 2 == 0 ) { //even
} else { /odd
}
i know that i must insert "fd = open("blabla",O_RDWR|O_CREAT,0)" after "if" but my knowlodge isnt enogh :(
thanks