home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!manuel!sserve!prolix!dac
- From: dac@prolix.pub.uu.oz.au (Andrew Clayton)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Ex problem with doule variable printf formatting
- Message-ID: <1b800afa.ARN22df@prolix.pub.uu.oz.au>
- Date: Fri, 14 Aug 92 14:04:10 GMT
- Reply-To: munnari!labtam!eyrie!prolix!dac
- FollowUp-To: comp.sys.amiga.programmer
- Keywords:
- Organization: More like Dis~, really.
- Lines: 29
-
- I posted a message a few days ago stating that I was getting
- 'weird' formatting of printf's of doubles. This was in addition
- to the [later revealed] SAS/C printf bug where numbers less than
- 1.0 were printed as 0. when defined as %2.0f.
-
- Today I located the spurious double problem. It was a stupid
- luser error.
-
- I wrote in my code:
-
- printf("Headerbytes %7ld (%2.2lf% of total bytes\n)"
- "Amount of quoted text %7ld (%2.2lf% of total bytes\n)",
-
- and when I ran the program I got very very weird printf values
- [like 120+byte strings of zeros with an 'f' at the end]
-
- The problem is the second percent symbol, which is, like, y'know,
- a totally basic printf hurdle.
-
- I should have used '%%' to print the percent symbol.
-
- Now fixed. I feel rather foolish. SNAFU. :-)
-
- Dac
- --
- munnari!labtam!eyrie!prolix!dac David Andrew Clayton. // _| _ _
- prolix!dac%eyrie@labtam.oz.au Canberra, Australia \X/ (_](_](_
- dac@prolix.pub.uu.oz.au I post .
- prolix!dac@sserve.cc.adfa.oz.au . . I am. +61 6 290 2215
-