delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/09/02:41:14

Date: Mon, 9 Apr 2001 09:43:18 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: fflush (in djgpp)
In-Reply-To: <dla2dto2m73ssffe78j3bn5pepr6lof116@4ax.com>
Message-ID: <Pine.SUN.3.91.1010409094239.27683L-100000@is>
MIME-Version: 1.0
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

On Mon, 9 Apr 2001, Jack Klein wrote:

> > > 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.
> 
> Yes, and one can spend years designing scanf() conversion specifiers.

I think ``years'' is an exaggeration.

> There is nothing that scanf() can do that fgets() followed by other
> functions, including sscanf(), can't do as well or better.

This argument goes both ways: scanf and fgets+sscanf are functionally
equivalent.  A C programmer should master both, IMHO.

- Raw text -


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