I have a program which has 2 children (running 2 processes by execl), and one fifo. I can't use printf, and I want both children to write and read from fifo. problem is, I want only first child to make sure that everything he writes to my FIFO will be printed out to the screen. "fifoCommunication" is the name of the fifo created by father. here is the code inside the first child's process only:
int main() {
int fd_write = open("fifoCommunication",O_WRONLY);
dup(fd_write,0);
write(fd_write,"to be printed to screen!" ,18);}
I know it's not the right syntax, but I don't know how to make sure the message is printed to the screen properly, and also preventing the other child to print messages to the screen, only to the FIFO.