scanf()/ gets()的问题

编程入门 行业动态 更新时间:2024-10-25 10:24:59
本文介绍了scanf()/ gets()的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不能接受长度超过127 的字符串(没有空格)... 条目限制为127个字符。 我已声明一个大小超过200的数组。 或 我使用了动态内存分配。 但回声停止

解决方案

su ************** @ yahoo.co.in 写道:

我不能接受长度超过127的字符串(没有空格) 无论我做什么.. 条目是限制为127个字符。 我已声明一个大小超过200的数组。 或 我使用了动态内存分配。 但回显已停止

听起来像是操作提供的输入缓冲区大小限制/> 系统,而不是C语言/库问题。

Mark Bluemel说:

su ************** @ yahoo.co.in 写道:

>我不能接受长度超过127的字符串(没有空格)无论我做什么.. 条目限制为127个字符。 我已经宣布一个大小超过200的数组。或我已经使用了动态内存分配。 但回显停止

听起来像是操作 系统提供的输入缓冲区大小的限制,而不是C语言/库问题。

如果标准允许,那么最小输入的最小值是多少?b $ b缓冲区大小是多少?如果没有说明,它实际上意味着即使托管 实现实际上也不必提供stdin,因为它们可以简单地将输入缓冲区大小设置为0,让它无法阅读 任何东西! 换句话说,我认为你错了 - 如果实施真的是 的行为如上所述,听起来不符合我的要求。但是我会高兴地指出我不确定自己的理由。 有时这样我就是诱惑喊CHRISSSSS !!! - Richard Heathfield< www.cpax.uk> 电子邮件:-http:// www。 + rjh @ 谷歌用户:< www.cpax.uk/prg/writings/googly.php> Usenet是一个奇怪的放置" - 1999年7月29日dmr

文章< 1t ************************* *****@bt>, Richard Heathfield< rj*@see.sig.invalidwrote:

>如果标准允许这样,那么最小输入缓冲区大小是多少?如果没有说明,它实际上意味着即使托管的实现也不必提供stdin,因为它们可以简单地将输入缓冲区大小设置为0,使其无法读取任何事情!

这将违反允许至少一个 字符的ungetc后推的要求。 - - 任何足够先进的错误都与功能无法区分。 - Rich Kulawiec

I can not accept a string (without space) of length more than 127 whatever I do.. Entry is restricted by 127 characters. I have declared an array of size more than 200. or I have used dynamic memory allocation. But the echo is stopped

解决方案

su**************@yahoo.co.in wrote:

I can not accept a string (without space) of length more than 127 whatever I do.. Entry is restricted by 127 characters. I have declared an array of size more than 200. or I have used dynamic memory allocation. But the echo is stopped

Sounds like a limit in the input buffer size provided by your operating system, not a C language/library issue.

Mark Bluemel said:

su**************@yahoo.co.in wrote:

>I can not accept a string (without space) of length more than 127whatever I do..Entry is restricted by 127 characters.I have declared an array of size more than 200.orI have used dynamic memory allocation.But the echo is stopped

Sounds like a limit in the input buffer size provided by your operating system, not a C language/library issue.

If that''s allowed by the Standard, what is the minimum such maximum input buffer size? If none is stated, it effectively means that even hosted implementations effectively don''t have to provide stdin, since they can simply set the input buffer size to 0, rendering it impossible to read anything in! In other words, I think you''re wrong - if the implementation is truly behaving as described, it sounds non-conforming to me. But I will cheerfully point out that I''m not sure of my ground. It''s at times like this that I''m tempted to shout "CHRISSSSS!!!" -- Richard Heathfield <www.cpax.uk> Email: -www. +rjh@ Google users: <www.cpax.uk/prg/writings/googly.php> "Usenet is a strange place" - dmr 29 July 1999

In article <1t******************************@bt>, Richard Heathfield <rj*@see.sig.invalidwrote:

>If that''s allowed by the Standard, what is the minimum such maximum inputbuffer size? If none is stated, it effectively means that even hostedimplementations effectively don''t have to provide stdin, since they cansimply set the input buffer size to 0, rendering it impossible to readanything in!

That would be contrary to the requirement to allow at least one character of ungetc pushback. -- "Any sufficiently advanced bug is indistinguishable from a feature." -- Rich Kulawiec

更多推荐

scanf()/ gets()的问题

本文发布于:2023-11-02 08:06:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551838.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:scanf

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!