home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 17968 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.9 KB  |  51 lines

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