参考getch? [英] getch?

查看:50
本文介绍了参考getch?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如何在按下''\ n'之前从标准输入读取字符?


for例如我知道我可以使用getch()从

用户输入中读取单个字符,但是假设我想在回车符

之前读取。


例如我输入一个字符,并且在按下

''\ n''之前完成以下操作。

谢谢

解决方案




Profetas写道:



如何在按下''\ n'之前从标准输入读取一个字符?

例如我知道我可以使用getch()从
用户输入读取单个字符,但是假设我想在按下回车符之前阅读。

例如我输入一个字符串和在按下
''\ n''之前完成以下操作。




常见问题解答19.4


您的问题*总是*是常见问题略有改写 - 要么你

这样做是为了让我们忙碌或者你懒得阅读事情。

不公平。承诺:


* PLONK *

-

电子邮件:我的是gmx dot de address。 />


Profetas写道:



如何在''之前从stdin读取一个char \ n''被按下了?


这是comp.lang.c中的问题19.1。经常

问答(FAQ)列表

http://www.eskimo.com/~scs/C-faq/ top.html

例如我知道我可以使用getch()从
用户输入读取单个字符,但是假设我想在回车之前阅读被压了。


< OT>有没有人注意到这个新闻组

短语我知道几乎总是会引入一个错误的

声明,或者至少是一个严重的误解?

我知道我不可能是唯一一个 - 哦,drat! < / OT>


标准C中没有getch()函数。如果你的

C实现恰好提供了一个,那就是一些实物

对C的扩展,而不是固有的。

例如我输入一个字符,并且在
''之前完成以下操作n''被按下。




FAQ。


-
Er ********* @ sun.com


< BLOCKQUOTE>>常见问题19.4

Corr:常见问题解答19.1

对不起

-

电子邮件:我的是一个gmx点de address。


Hi,

How do I read a char from stdin before the ''\n'' is pressed?

for example I know that I can use getch() to read a single char from the
user input, but suppose I wanted to read before the carriage return is
pressed.

for example I type a char and the following actions is done before the
''\n'' is pressed.

Thanks

解决方案



Profetas wrote:

Hi,

How do I read a char from stdin before the ''\n'' is pressed?

for example I know that I can use getch() to read a single char from the
user input, but suppose I wanted to read before the carriage return is
pressed.

for example I type a char and the following actions is done before the
''\n'' is pressed.



FAQ 19.4

Your questions *always* are FAQ slightly rewritten -- either you
are doing this to keep us busy or you are too lazy to read the thing.
Not fair. As promissed:

*PLONK*
--
E-Mail: Mine is a gmx dot de address.


Profetas wrote:

Hi,

How do I read a char from stdin before the ''\n'' is pressed?
This is Question 19.1 in the comp.lang.c Frequently
Asked Questions (FAQ) list

http://www.eskimo.com/~scs/C-faq/top.html
for example I know that I can use getch() to read a single char from the
user input, but suppose I wanted to read before the carriage return is
pressed.
<OT>Has anyone else noticed that on this newsgroup
the phrase "I know" almost always introduces a false
statement, or at the very least a gross misunderstanding?
I know I can''t be the only one who-- oh, drat!</OT>

There is no getch() function in Standard C. If your
C implementation happens to provide one, it''s some kind
of extension to C, tacked on rather than inherent.
for example I type a char and the following actions is done before the
''\n'' is pressed.



FAQ.

--
Er*********@sun.com


> FAQ 19.4
Corr: FAQ 19.1
Sorry
--
E-Mail: Mine is a gmx dot de address.


这篇关于参考getch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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