scanf()/ gets()的问题 [英] Problem with scanf()/gets()

查看:61
本文介绍了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< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - 1999年7月29日dmr


文章< 1t ************************* *****@bt.com>,

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 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.

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 <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


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

>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!

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()的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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