You are here: Re: Where to Find Pipe Information? « PHP Programming Language « IT news, forums, messages
Re: Where to Find Pipe Information?

Posted by Keith Thompson on 08/16/06 03:02

Keith Thompson <kst-u@mib.org> writes:
> "Chung Leong" <chernyshevsky@hotmail.com> writes:
>> SadOldGit wrote:
>>> Chung Leong wrote:
>>> > Google "stdio.h". To read from stdin, you just do it as though you're
>>> > reading from the keyboard, with functions like gets()
>>>
>>> I seriously hope you are not using gets() !!!!
>>
>> It's been a while since I last use the stdio function :-) I vaguely
>> remember that the command-line in MS-DOS has a certain limit, so it was
>> actually OK to use gets(). scanf() was the one to avoid.
>
> No, it's ok to use gets().

ARGH!

What I meant to write was:

No, it's *not* ok to use gets().

Never. Never ever.

Use fgets() (and watch out for the trailing '\n'). Or read a
character at a time. Or use some custom routine like ggets().

gets(), for all practical purposes, cannot be used safely. It is a
buffer overflow waiting to happen.

(I'll try to cancel the article, but I doubt that it will work.)

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация