问题描述
限时送ChatGPT账号..如何检查刚刚使用 CreateProcess() 启动的 CLI 程序是否正在等待使用 Windows C API 的 stdin 输入?
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?
推荐答案
正如上面的一些评论所说,一旦程序已经开始等待,您就无法检查它是否正在等待 stdin.您可以使用事件处理程序,或者您可以简单地从标准输入读取超时,在超时发生时您标记您正在等待输入并再次开始等待超时.
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.
这篇关于如何检查 CLI 程序是否正在等待来自 stdin 的输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论