如何做到即时地读入信息?[C++即可]
PHP中文网
PHP中文网 2017-04-17 11:44:14
0
2
586

我遇到的问题是这样的:
平时我们scanf("%d",&tee);必须要回车啊之类的空白符确认才行
那有没有像chrome搜索栏(或者baidu……)那样的即输(入)即得?
不需要按回车就能读入应该如何实现?

谢谢:)

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
左手右手慢动作

This may help you
http://stackoverflow.com/questions/421860/capture-characters-from-standard-input-without-waiting-for-enter-to-be-pressed

PS: If you encounter technical problems, try using Google and stackoverflow, :)

大家讲道理

scanf is obviously not suitable for this. This is to determine whether the input is completed based on the user's input and press Enter. The two you mentioned are in GUI mode. I suggest you look at the Windows API or some packaged APIs, so Hook each input of the user. For example, if the user expects to input "C++ programming", the user will input "C", "+", "+", "program", and "program" in sequence. The characters you intercepted Then put it in the background for processing, and then put it in the display interface for display.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template