Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Answers:
- // 1. This is probably not the author's intention, but I didn't call wait(). Sending a signal might also work.
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- int main(int argc, char *argv[]) {
- int rc = fork();
- if (rc < 0) {
- fprintf(stderr, "fork failed\n");
- exit(1);
- } else if (rc == 0) {
- printf("hello\n");
- } else {
- waitpid(-1, NULL, 0);
- printf("goodbye\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment