【发布时间】:2013-12-14 02:23:42
【问题描述】:
这个问题可能有点难以说明。例如,一个程序接收来自stdin 的字符串,但它需要来自用户的交互式输入,如下所示:
echo "Some text to handle later after command is specified" | a.out
在程序的开头:
printf("Please input command first");
scanf("%s", &cmd);
/* Some Code Here */
/* process "Some text to handle later after command is specified" */
有没有办法“暂停”先前的输入流并等待scanf 的输入流?
【问题讨论】: