home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / os2 / programm / 7022 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  1.1 KB

  1. Path: sparky!uunet!think.com!rpi!news.ans.net!cmcl2!acf5!checker
  2. From: checker@acf5.NYU.EDU (checker)
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: Re: AT&T enhancements for the DAP CD-ROM disk for $10. Worth it?
  5. Message-ID: <2106@acf5.NYU.EDU>
  6. Date: 15 Dec 92 05:58:06 GMT
  7. References: <Bz7L6w.3r8@cs.uiuc.edu> <19921214.065050.16@almaden.ibm.com>
  8. Organization: New York University
  9. Lines: 21
  10.  
  11. lansche@torolab6.VNET.IBM.COM (Martin Lansche) writes about iostreams: 
  12.  
  13. >  If you are doing stdio-type of programming, then (1) [streams] is
  14. > also useful. If you are doing PM programming, it is not.
  15.  
  16. Actually, strstreams are very useful even if you never use stdio. 
  17. Temporary formatting buffers are a breeze:
  18.  
  19. char aBuffer[100];
  20. ostrstream Out(aBuffer,100);
  21.  
  22. Out<<"This is a double: "<<1.34<<endl<<"An int: "<<234<<ends;
  23.  
  24. They are ever so much easier to use than sprintf and safer; it's
  25. typesafe and it won't overflow the array.  If you don't construct it
  26. with a buffer it dynamically allocates one for you and grows it as
  27. necessary.  Don't forget the ends at the end or you won't have a null
  28. terminated buffer.
  29.  
  30. Chris
  31.  
  32.