Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!dogie.macc.wisc.edu!uwvax!shorty!engber From: engber@shorty.CS.WISC.EDU (Mike Engber) Newsgroups: comp.lang.c Subject: field width in scanf for reals Summary: e's don't seem to count Message-ID: <7562@spool.cs.wisc.edu> Date: 23 May 89 17:39:43 GMT Sender: news@spool.cs.wisc.edu Reply-To: engber@shorty.cs.wisc.edu (Mike Engber) Organization: U of Wisconsin CS Dept Lines: 13 I've found that when reading reals in exponential format using scanf with a field width specifier that the e for the exponent doesn't seem to count as part of the field width. To read 1.2e3 you need to use "%4f". I've tried this out on several UNIX machines and they all seem to have the same bug/feature. The SUN compiler, however, worked as you'd expect. It needed a field width of 5. Does anyone have an explanation of all this. I assume it's compiler bugs. please respond via email -ME