From: sparhawk AT eunet DOT at (Gerhard Gruber) Newsgroups: comp.os.msdos.djgpp Subject: Re: Date: Mon, 31 Aug 1998 06:47:42 GMT Organization: EUnet Austria Lines: 27 Message-ID: <35ea9738.15981717@news.Austria.EU.net> References: <35E881DF DOT 7106 AT geocities DOT com> <6sb36g$hos AT news-central DOT tiac DOT net> <35E976E1 DOT 3B00 AT geocities DOT com> NNTP-Posting-Host: e167.dynamic.vienna.at.eu.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Date: 31 Aug 1998 06:49:24 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Content-Transfer-Encoding: 8bit Precedence: bulk Destination: Adam Brown From: Gruber Gerhard Group: comp.os.msdos.djgpp Date: Sun, 30 Aug 1998 17:59:29 +0200: >> fgets() is a good deal safer than gets(). >> sscanf() does a hell of a better job than sprintf() at handling input. > >In what way? sscanf() reads the input from a memory region and thus you already know the maximum amount of memory that will be needed. This is only neccessary for strings, though, because scanf() reads up to the next whitespace or CR. This means you provide i.e. 30 characters for a string and the user types in 40 and BINGO! your program crashes. -- Bye, Gerhard email: sparhawk AT eunet DOT at g DOT gruber AT sis DOT co DOT at Spelling corrections are appreciated.