Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!ogicse!emory!gatech!prism!jt2 From: jt2@prism.gatech.EDU (TROSTEL,JOHN M) Newsgroups: comp.lang.c Subject: fscanf bug in TC (BC) C++ 2.0 Keywords: turbo C++ Message-ID: <26502@hydra.gatech.EDU> Date: 17 Apr 91 13:54:21 GMT References: <1991Apr14.215819.16486@allgfx.agi.oz> <1991Apr16.141117.5065@odin.diku.dk> Distribution: usa Organization: Georgia Institute of Technology Lines: 54 In article <1991Apr16.141117.5065@odin.diku.dk> juul@diku.dk (Anders Juul Munch) writes: >cn@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@prism.gatech.edu