如何更改换行键的空间来完成从输入流中读取数据? [英] How to change newline button to space to finish reading from input stream?

查看:157
本文介绍了如何更改换行键的空间来完成从输入流中读取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要阅读从输入流符号的行不读每一个符号后,将新行。更多precisely,我需要空间读取每个新符号后更改击中Enter键。有没有办法做到这一点不读所有的行到一个字符串,之后解析字符串?任何选项是可以接受的,就像scanf函数,CIN。

I need to read a row of symbols from input stream without going to new line after reading each symbol. More precisely, I need to change hitting the "Enter" button to "Space" after reading each new symbol. Is there a way to do it without reading all row to a string and parsing string after that? Any options are acceptable, like scanf, cin.

推荐答案

如果你可以使用CONIO.H那么你就可以做到这一点在字符数组的getch()函数读取输入。或者如果你是在Visual Studio中您可以使用_getch()函数相同的结果。

If you can use conio.h then you can do that by reading input in a character array with getch() function. Or if you are in visual studio you can use _getch() function for the same result.

CONIO.H定义了一个名为的getch()的函数和getche(),它读取一个字符,然后终止没有任何回车键。这两个函数都有特定的含义,而他们做同样的工作。我不使用任何那些越是这样,我不记得了。这是你高达如果你想使用它们或不...

conio.h defines function named getch() and getche() which reads a character then terminates without any enter key. Both these functions have specific meanings while they do the same task. I don't use those any more so I don't remember much. It's upto you if you wanna use them or not...

这篇关于如何更改换行键的空间来完成从输入流中读取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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