如何检查是否CLI程序从标准输入等待输入? [英] How can I check if a CLI program is waiting for input from stdin?

查看:191
本文介绍了如何检查是否CLI程序从标准输入等待输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检查是否CLI程序,我刚开始用的CreateProcess(),是从与Windows C API标准输入等待输入?

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?

推荐答案

一些上面所说的意见,一旦它已经开始在等待你不能检查,如果你的程序是等待标准输入。你可以使用一个事件处理程序,或者你可以简单地读从超时,在这里您正在等待输入,并开始再次超时等待超时你标志的发生。

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程序从标准输入等待输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆