fscanf bug in TC (BC) C++ 2.0
TROSTEL,JOHN M
jt2 at prism.gatech.EDU
Wed Apr 17 23:54:21 AEST 1991
In article <1991Apr16.141117.5065 at odin.diku.dk> juul at diku.dk (Anders Juul Munch) writes:
>cn at allgfx.agi.oz (Con Neri) writes:
>
>>Hi netters,
>> I havec been working with a friend developing some code using
>>Turbo C++ V1.5 but only writing in standard C. We have been getting an error
>>with a particular piece of code, namely
>
>> fscanf(fp,"%f", &f);
>
>> The runtime error is
>
>> scanf: floating point formats not linked.
>> Abnormal Program termination.
>
>> Can some one shed some light on what this means?
i have found the same problem. The way I worked around it was to declare
a new float variable, say fl_var, and use it to read in my data. See old
and new code below:
OLD CODE:
...
float *f_ptr;
...
f_ptr = (float *)calloc(...);
...
fscanf(file,"%f",f_ptr);
...
^----- gives the run time error
NEW CODE:
...
float *f_ptr, new_var;
...
f_ptr=(float *)calloc(...);
...
fscanf(file,"%f",&new_var);
f_ptr[i] = new_var; /* i'm inside a loop here */
....
^------ this code works!!??
Well, I can't figure it! Nothing else was changed in the program to
make it work. That is it DIDN'T like the address sent to it with
using just 'f_ptr' but DID like the address it got with '&new_var'.
Anyone else figure this out more? Anyone from Borland about to tell
us how to fix this?
--
John M. Trostel ( aka Kayak-Man )
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!jt2
Internet: jt2 at prism.gatech.edu
More information about the Comp.lang.c
mailing list