I am trying to write two strings 'username' and 'passwd' into my child process as stdin, and run 'checker' to varify the username/passwd combo and return a value back to the parent process. Somehow my code doesn't work because "the checker program could not read from stdin" How should I fix this?

pid_t pid;
int status;
int fd[2];

pid = fork(); 
if ((pipe(fd)) ==-1){
    perror("pipe");
    exit(1);
}

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top