服务器端:
客户端:
//发送参数值
WriteFile(hChildStdInWrite, args, sizeof(args), &dwWrite, NULL);
printf("客户端正写入管道的参数:(%d, %d)/r/n", args[0], args[1]);
DWORD dwRead = 0;
int c = 0;
ReadFile(hChildStdOutRead, &c, sizeof(c), &dwRead, NULL);
printf("客户端读取管道的计算结果:%d + %d = %d/r/n", args[0], args[1], c);
}
return 0;
}
测试结果:
==========这里是客户端==========
客户端正写入管道的参数:(16, 26)
客户端读取管道的计算结果:16 + 26 = 42
请按任意键继续. . .