Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!wuarchive!wuphys!marty From: marty@wuphys.wustl.edu (Marty Olevitch) Newsgroups: comp.sys.ibm.pc.programmer Subject: atof() problem in Turbo C 2.0 Message-ID: <1990Jun11.195944.26213@wuphys.wustl.edu> Date: 11 Jun 90 19:59:44 GMT Reply-To: marty@wuphys.UUCP (Marty Olevitch) Organization: Physics Dept, Washington U. in St Louis Lines: 35 Here is something I've just noticed in using the atof() library routine in Turbo C 2.0. When the following test program is compiled with the "-DWEIRD" option, the correct answer is printed. However, when "WEIRD" is not #defined, the error message "scanf : floating point formats not linked" is printed at runtime. Does the compilation of the sscanf() load in some other code needed for atof()? If so, how do I get this code loaded without the dummy call to sscanf() (which in the example is never executed). Thanks, Marty Olevitch Internet: marty@wuphys.wustl.edu Washington University UUCP: uunet!wugate!wuphys!marty Physics Department, Campus Box 1105 Bitnet: marty@wuphys.WUSTL St Louis MO 63130 USA Tel: (314) 889-6285 /* atoftest */ #include main() { char s[10]; double a; int yuck; sprintf(s," 1.00"); #ifdef WEIRD yuck = 0; if(yuck == 1) sscanf(s, "%f", &a); #endif a = atof(s); printf("%f\n", a); }