Skip to content

Instantly share code, notes, and snippets.

@AlexsJones
Created May 25, 2012 10:46
Show Gist options
  • Select an option

  • Save AlexsJones/2787261 to your computer and use it in GitHub Desktop.

Select an option

Save AlexsJones/2787261 to your computer and use it in GitHub Desktop.
Child getline problem
#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