Mail Archives: djgpp/1994/09/01/13:14:35
David,
Well, to be sure I was not losing my mind, I just tried both your
original and modified programs on my SPARCstation 10 running
SunOS 5.3 and using the SPARCcompiler 3.0.1 package. Your original
program caused the same repetitive behavior that you initially
described and I expected, and your modified version worked
correctly (it just waited for more input after printing "i=?; j=0".
Also, the Microsoft C that I always used to use (before I swithed
to djgpp) had the same scanf() behavior. Until I get home to my
PC tonight, though, I will not be able to try to figure out why
you can't get it working with djgpp...
Personally, I have always disliked the behavior of scanf(), so for
any semi-real programs I prefer a gets(), then using sscanf() as
necessary. I am much more comfortable separating the steps of
reading a line of input and parsing the resultant string.
Peter Jones
- Raw text -