delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/09/01/13:14:35

Date: Thu, 1 Sep 1994 12:21:52 -0400
From: pjones AT acs DOT bu DOT edu
To: pjones AT acs DOT bu DOT edu, ronis AT onsager DOT chem DOT mcgill DOT ca
Subject: Re: bug in scanf()
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

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 -


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