Mail Archives: djgpp/2001/04/09/02:41:14
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 -