home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18846 < prev    next >
Encoding:
Text File  |  1993-01-08  |  802 b   |  28 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: How to limit string output length w/ stream manips?
  5. Message-ID: <1993Jan8.183239.10873@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <1993Jan8.025836.10039@news.ysu.edu>
  8. Date: Fri, 8 Jan 1993 18:32:39 GMT
  9. Lines: 17
  10.  
  11. af458@yfn.ysu.edu (Jon K. Salmon) writes:
  12.  
  13.  
  14. >I would like to limit the output length of a string sent to an
  15. >output stream.  For example, given a string...
  16.  
  17. >  const char *Bob = "1234567890ABCDEF";
  18.  
  19. > ... to output "12345"?
  20.  
  21. As with printf(), the iostream inserters never truncate a value; output
  22. width is a minimum, not an absolute.
  23.  
  24. If you want to truncate a string, you have to do the truncation yourself.
  25. -- 
  26.  
  27. Steve Clamage, TauMetric Corp, steve@taumet.com
  28.