Okay I am trying to write a program where a parent process creates three child processes. Also waits for each of them to finish. Here is my code:
#include <stdio.h>
#include <unistd.h>
main() {
int i;
// create 3 child processes
for (i = 0; i < 3; i++) {
if (fork() == 0) {
printf("Child process no.%d with ID: %d created from parent process\n", i);
break;
}
}
// wait for each child process to finish
}
There is one error line "if (fork() == 0) {"
What is wrong with that? I tried to run it using Dev-C++.
How do I build the wait() for each of those three child processes to finish?
By the way, is there any software that allow me to use a virtual terminal (aka command) Unix/Linux on Windows?