-
Notifications
You must be signed in to change notification settings - Fork 0
/
wait.c
43 lines (29 loc) · 866 Bytes
/
wait.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
https://powcoder.com
代写代考加微信 powcoder
Assignment Project Exam Help
Add WeChat powcoder
https://powcoder.com
代写代考加微信 powcoder
Assignment Project Exam Help
Add WeChat powcoder
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <string.h>
int main(int argc, char **argv) {
// Declare any variables you need
// Write the code to loop over the command line arguments.
// (Remember to skip the executable name.)
for (int i = 1; i < argc; i++) {
// call fork
if () { // system call error
// handle the error
} else if () { // child process
// child does their work here
}
}
// Finish the code to sum up the return values from the children
printf("The length of all the args is %d\n",sum);
return 0;
}