www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/08/17:20:19

Date: Sun, 08 Apr 2001 23:17:55 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Jack Klein <jackklein AT spamcop DOT net>
Message-Id: <4331-Sun08Apr2001231754+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <82j1dtc5m6lg195fo29ddc7r19vrp4v0k7@4ax.com> (message from Jack
Klein on Sun, 08 Apr 2001 20:49:13 GMT)
Subject: Re: fflush (in djgpp)
References: <9aqfuu$fnb$1 AT uranium DOT btinternet DOT com> <82j1dtc5m6lg195fo29ddc7r19vrp4v0k7 AT 4ax DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Jack Klein <jackklein AT spamcop DOT net>
> Newsgroups: comp.os.msdos.djgpp
> Date: Sun, 08 Apr 2001 20:49:13 GMT
> 
> The real work around is to never, never use scanf() for interactive
> user input.  The function is poorly designed in the first place, and
> it can be tricky to use

scanf isn't poorly designed, it's just very powerful and takes time to
master.  Newbies are well advised to avoid using it for interactive
input.

But if you do master scanf, you can do anything with it; so there's no
need to scare users from trying to learn scanf better.

> If you think I am exaggerating, run the program that you have and
> enter "xyz" at the first prompt for age and see what happens.  Even on
> some systems that define a non-standard extension to fflush() that
> does what you think you want it to do, it does not fix a problem like
> this.

With a proper format string, this can be handled with scanf as well.

- Raw text -


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