如何对cin进行非阻塞调用? [英] How to make non-blocking call to cin?
问题描述
它是否可能或/并且有更好的选择以非阻塞的方式接受
输入?
< blockquote> puzzlecracker写道:
它是否可能或/并且有更好的选择以非阻塞的方式接受
输入?
您可以尝试使用''peek''成员函数。如果没有
输入可用,你应该得到''eof'',我猜,但是不要接受我的话,RTFM
和实验。
V
-
请在通过电子邮件回复时删除资金''A'
我没有回复最热门的回复,请不要问
9月26日下午6:09,Victor Bazarov< v.Abaza ... @ comAcast.netwrote:
puzzlecracker写道:
甚至可能或/和有一个更好的选择,以非阻塞方式接受
输入?
您可以尝试使用''peek''成员函数。你应该得到
''eof''如果没有可用的输入,我猜,但是我不能把它用于它,RTFM和实验。
Peek将等待一个角色是不可用的。
基本上,peek()就像get(),除了它不会从流中提取
字符。
-
James Kanze(GABI软件)电子邮件:ja ********* @ gmail.com
Conseils eninformatiqueorientéeobjet/
Beratung in objektorientierter Datenverarbeitung
9地点Sémard,78210 St.-Cyr-l''coco,法国,+ 33(0)1 30 23 00 34
James Kanze写道:
< blockquote class =post_quotes>
9月26日下午6:09,Victor Bazarov< v.Abaza ... @ comAcast.netwrote:
> puzzlecracker写道:
>>它是否可能或/并且有更好的选择以非阻塞方式接受
输入?
>您可以尝试使用''peek''成员函数。如果没有可用的输入,你应该得到''eof'',我猜,但是不要接受我的话,RTFM和实验。
Peek将等待一个角色是不可用的。
基本上,peek()就像get(),除了它不会从流中提取
字符。
然后它又回到了平台或特定于实现的扩展,我想这是图库中的$ b $。
V
-
请在通过电子邮件回复时删除资金''A'
我没有回复最热门的回复,请不要问
is it even possible or/and there is a better alternative to accept
input in a nonblocking manner?
puzzlecracker wrote:is it even possible or/and there is a better alternative to accept
input in a nonblocking manner?You could try using ''peek'' member function. You should get ''eof'' if no
input is available, I am guessing, but don''t take my word for it, RTFM
and experiment.
V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask
On Sep 26, 6:09 pm, Victor Bazarov <v.Abaza...@comAcast.netwrote:puzzlecracker wrote:is it even possible or/and there is a better alternative to accept
input in a nonblocking manner?
You could try using ''peek'' member function. You should get
''eof'' if no input is available, I am guessing, but don''t take
my word for it, RTFM and experiment.Peek will wait for a character is one isn''t available.
Basically, peek() is like get(), except that it doesn''t extract
the character from the stream.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34
James Kanze wrote:On Sep 26, 6:09 pm, Victor Bazarov <v.Abaza...@comAcast.netwrote:>puzzlecracker wrote:>>is it even possible or/and there is a better alternative to accept
input in a nonblocking manner?
>You could try using ''peek'' member function. You should get
''eof'' if no input is available, I am guessing, but don''t take
my word for it, RTFM and experiment.
Peek will wait for a character is one isn''t available.
Basically, peek() is like get(), except that it doesn''t extract
the character from the stream.Then it''s back to the platform- or implementation-specific extensions to
the library, I guess.
V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask
这篇关于如何对cin进行非阻塞调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!