Article View: comp.sys.amiga.tech
Article #5954scanf() weirdness with Aztec 5.0a--please help?
From: Dan Zerkle
Date: Fri, 19 Oct 1990 05:34
Date: Fri, 19 Oct 1990 05:34
49 lines
2016 bytes
2016 bytes
Trying to write a program with A3000 2.0 & Aztec C 5.0a.
I'm having some serious problems with i/o of double-valued
information. Here is a bit of code to illustrate the problem:
main()
{
double dval;
scanf("%lf",&dval);
printf("%lf\n",dval);
}
If I compile without using 68881 code or libraries, this does as one
would expect:
cc testprg.c
ln testprg.o -lm -lc
testprg
5.7 <- I typed
5.700000 <- Output by program.
But, when I use the 68881, bad things happen:
cc -f8 testprg.c
ln testprg.o -lm8 -lc
testprg
5.7 <- I typed
++++++ <- Output by program ????
A little fooling around with the debugger *seems* to indicate that
proper values are not being read properly by scanf, but I'm not sure
about this (can you say Guru...er software error?). Another program
(the real one) with only fscanf's was not getting good values out of a
file, thus motivating this post.
So, what is wrong here? One of these is the correct answer:
a I'm not compiling/linking properly, I should....
b My code stinks, and what's wrong with it....
c Scanf doesn't work right on 5.0a, wait for 5.0d to show up in the
mail....
d Manx doesn't know what they are doing, and I should buy Lattice....
In case it matters, I HAVE to use the coprocessor (or never finish
before the due date). That's part of why I got the 3000.
Dan Zerkle zerkle@iris.ucdavis.edu (916) 754-0240
Amiga... Because life is too short for boring computers.
Technical Details
Message-ID:
<7847@ucdavis.ucdavis.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!ucbvax!ucdavis!iris!zerkleShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!ucbvax!ucdavis!iris!zerkle From: zerkle@iris.ucdavis.edu (Dan Zerkle) Newsgroups: comp.sys.amiga.tech Subject: scanf() weirdness with Aztec 5.0a--please help? Message-ID: <7847@ucdavis.ucdavis.edu> Date: 19 Oct 90 05:34:06 GMT Sender: usenet@ucdavis.ucdavis.edu Reply-To: zerkle@iris.ucdavis.edu (Dan Zerkle) Organization: U.C. Davis - Department of Electrical Engineering and Computer Science Lines: 49