Mail Archives: djgpp/2001/04/08/17:20:19
> 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 -