Last active
December 2, 2015 19:49
-
-
Save ha7ilm/52171f12b690e54250dc to your computer and use it in GitHub Desktop.
stdin behaviour test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
int main() | |
{ | |
pid_t p; | |
int stat; | |
int i; | |
if(!(p = fork())) | |
{ | |
execl("/bin/bash","bash", "-c","csdr through >/dev/null",NULL); | |
fprintf(stderr, "child failed to execl, now exits...\n"); return; | |
} | |
fprintf(stderr, "parent wait\n"); | |
while(1) wait(&stat); | |
fprintf(stderr, "parent exited\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment