home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!usc!rpi!uwm.edu!linac!att!princeton!csservices!atomic!mg
- From: mg@atomic (Michael Golan)
- Subject: Re: Just what is so great about streams?
- Message-ID: <mg.724385443@atomic>
- Sender: news@csservices.Princeton.EDU (USENET News System)
- Organization: Princeton University, Dept. of Computer Science
- References: <1992Nov24.195839.16054@rchland.ibm.com> <murison.35.0@cfa.harvard.edu> <mg.723017110@elan> <84964@ut-emx.uucp>
- Date: 15 Dec 92 02:10:43 GMT
- Lines: 39
-
- jamshid@ut-emx.uucp (Jamshid Afshar) writes:
-
- >In article <mg.723017110@elan> mg@elan (Michael Golan) writes:
- >>murison@cfa.harvard.edu (Marc A. Murison) writes:
- >>>I found that I liked the
- >>>iostream i/o mainly because it relieved me of the tedium of (1) having
- >>>to remember format codes,
- >>
- >>I'd go for memorizing %8.3f anyday, rathar than ios:: ... (what is it, I
- >>still don't remember - fixed(3) precision(8) ?) ...
-
- >And what does %g mean as opposed to %f and %e?
- Well, 'e' for funny output with 'e' numbers... 'f' for 'f'ixed, 'g' for
- 'g'eneral format, right? :-)
-
- I think people say printf() formats are harder because the documentation is so
- terse. Just provide as many pages on printf as you do on manipulators, and
- include the most commnon examples, and you are fine.
- Most of the people who complain really need just:
- %Id %Io %Ix %N.Mf %N.Mg %N.Me and %X.Ys %-X.Ys
- I is number of digits
- N.M is total-space.digits after the demical point
- - for strings left adjust
- X is minimum chars to print, spaces are padded as needed
- Y is maximum chars to print, as if outs[Y] was '\0' when you output 'outs'
-
- Try to write the docs for the equivalent iostream!!
- I tried to get %8.3f, the most common format (IMO), under iostream. I
- couldnt find it in two C++ manuals (and I read the docs wrong, too,
- thinking precision was number of digits after the dec pt.)
-
-
- Michael Golan
- mg@princeton.edu
-
-
-
-
-
-