Created
May 25, 2012 10:46
-
-
Save AlexsJones/2787261 to your computer and use it in GitHub Desktop.
Child getline problem
This file contains hidden or 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 <sys/types.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| int main(int argc, char* argv[]) | |
| { | |
| pid_t _pid; | |
| // int _pipe[2]; | |
| // pipe(_pipe); | |
| _pid = fork(); | |
| char buff[256]; | |
| int _scanned; | |
| int len = 100; | |
| if(_pid == 0) | |
| { | |
| printf("\nChild process.. %d\n",_pid); | |
| printf("Please enter your details...\n"); | |
| _scanned = getline(&buff,&len,stdin); | |
| printf("%s\n",buff); | |
| printf("Done..."); | |
| } | |
| else | |
| { | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment