Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <signal.h>
- #include <sys/signal.h>
- #include <ctype.h>
- #include <sys/wait.h>
- int stop = 0;
- int main() {
- FILE *input = fopen("input.txt", "r");
- FILE *output = fopen("output.txt", "w");
- int p0, p1, p2;
- char znak;
- p0 = getpid();
- printf("p0: %d\n", p0);
- if ((p1 = fork()) == 0) {
- while (stop != 1) {
- p1 = getpid();
- printf("p1: %d\n", p1);
- kill(p1, SIGINT);
- }
- exit(0);
- }
- if ((p2 = fork()) == 0) {
- while (stop != 1) {
- p2 = getpid();
- printf("p2: %d\n", p2);
- kill(p2, SIGINT);
- }
- exit(0);
- }
- wait(NULL);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement