当dup2俩参数分别为stdin stdout会发生什么
include <unistd.h> //dup2, STDIN_FILENO, STDOUT_FILENO
int main(void)
{
int socketPipe[2]; //0 = read, 1 = write
pipe(socketPipe);
dup2(socketPipe[0], STDIN_FILENO);
dup2(socketPipe[1], STDOUT_FILENO);
while(1);
return 0;
}
为何运行无输出?
做你昼夜骑士
10 years, 2 months ago