[comp.sys.amiga.tech] scanf

zerkle@iris.ucdavis.edu (Dan Zerkle) (10/19/90)

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.