这样的程序从stdin获取输入,并在stdout上打印其输出。为了使我的代码与这个程序通信,我使用管道将stdin和stdout重定向到缓冲区。;
saved_stdin = dup(STDIN_FILENO); /* save stdin for later */更多细节:这是在Linux上。取消命名-a的结果为:
Linu
我正在windows计算机上用cygwin编译和执行我的程序。我对C非常缺乏经验,但是我想要一种方法来检测一个键是否被按下,而没有提示用户(例如我)。下面显示了具有理想函数的伪代码。while(1){ //a key has been pressed before getting here if(ch=='0'){