关于 C 中 getchar() 的问题?
我正在学习和阅读一本C书。在书中,他们说:“getchar() 从标准输入流缓冲区检索单个字符,而不翻译输入。”
我不明白作者所说的“不翻译输入”是什么意思。我尝试过谷歌搜索,但没有运气。
谢谢。
I am learning and reading a C book. In the book, they say: "getchar() retrieves a single character from the standard input stream buffer without translating the input. "
I do not understand what the author mean by saying "without translating the input". I have tried googling, bu no luck.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许作者的意思是,字符被读取为字符,而不是转换为其他一些数据类型。例如,如果您使用 scanf("%d"),数字序列将转换为整数值。
Perhaps the author means that, characters are read as characters and not converted to some other data types. For example, if you used scanf("%d"), sequence of digits will be converted to an integer value.
我想这意味着您在输入流中获得的任何内容都是您将从 getchar() 调用中获得的内容。没有自动转换,也没有进行任何更改。也许这也意味着输入也不会被修改,例如,如果输入流是文件。
I guess it means that whatever you get in the input stream is what you will get from the getchar() call. There is no automatic conversion, or any changes done. Perhaps also it means that the input is also not modified, for example if the input stream is a file.