delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/30/12:31:04

Date: Sun, 30 Aug 1998 19:30:28 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Adam Brown <adambrown1 AT geocities DOT com>
cc: djgpp AT delorie DOT com
Subject: Re:
In-Reply-To: <35E976E1.3B00@geocities.com>
Message-ID: <Pine.SUN.3.91.980830192842.21083B-100000@is>
MIME-Version: 1.0

On Sun, 30 Aug 1998, Adam Brown wrote:

> > fgets() is a good deal safer than gets().

Because fgets allows you to limit the amount of characters read.  gets, 
on the other hand, will joyfully read past the end of the buffer you 
supply and trash the stack.  (Actually, a well-known case of a Trojan 
horse program was based on this.)

> > sscanf() does a hell of a better job than sprintf() at handling input.
> 
> In what way?
 
sprintf is for output, not for input.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019