Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char new_line[1];
- new_line[0] = 10;
- int **fd = (int **) malloc (no_of_processes * sizeof(int *));
- //write (fd[2][1], argv[2], strlen (argv[2]));
- for (int i = 0; i < no_of_processes; i++) {
- fd[i] = (int *) malloc (2 * sizeof(int));
- if (pipe(fd[i]) == -1) {
- printf ("Pipe fail");
- }
- for (int j = i; j < count; j += no_of_processes) {
- printf ("-\n");
- write (fd[1][i], argv[j], strlen (argv[j]));
- write (fd[i][1], new_line, 1);
- printf ("%d\n", j);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement