Date: Fri, 1 Aug 1997 10:25:31 -0700 (PDT) Message-Id: <199708011725.KAA16386@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: rcoca AT pcnet DOT pcnet DOT ro (Razvan) From: Nate Eldredge Subject: Re: scanf? Cc: djgpp AT delorie DOT com Precedence: bulk I don't dare describe it as a bug, but IMHO it's at least a misfeature. The problem is that scanf("%e",...) (or %f, or %g) reads a float. But if you use upper case, it reads a double instead (or a long double if you use an `l' already). As a workaround, to read a double, use the standard %le format. Can somebody with a copy of the ANSI standard enlighten us as to whether this is supposed to happen? There is already a bug with formats like %LG, for which I posted a patch some time ago. At 09:15 7/31/1997, you wrote: >--------------- >#include >#include >double d; > >int main(int argc,char*argv[]) > {clrscr(); > /* this doesn`t work*/ > scanf("%e",&d); > printf("\n%E",d); > >/* this works */ > scanf("%E",&d); > printf("\n%E",d); > > getch(); > return 0; > } > -------- >I couldn`t believe myself until I tried. >I was running this in a dos box under win95. I checked under plain >dos: the question holds (is this a known libc bug?). >There`s even more. If I put first scanf("%g",&d); it works fine. >The input didn`t have any exponent. Nate Eldredge eldredge AT ap DOT net