How can I check if a CLI program is waiting for input from stdin?

a 夏天 提交于 2020-01-13 16:48:07

问题


How can I check if a CLI program, that I just started with CreateProcess(), is waiting for input from stdin with the Windows C API?


回答1:


as some of the comments above have said, you cannot check if your program is waiting for stdin once it has already started waiting. You could use an event handler or you could simply have a read from stdin with a timeout, where on occurrence of the timeout you flag that you are waiting for input and start waiting with a timeout again.



来源:https://stackoverflow.com/questions/10803122/how-can-i-check-if-a-cli-program-is-waiting-for-input-from-stdin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!