home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!malgudi.oar.net!news.ysu.edu!do-not-reply-to-path
- From: af458@yfn.ysu.edu (Jon K. Salmon)
- Subject: How to limit string output length w/ stream manips?
- Message-ID: <1993Jan8.025836.10039@news.ysu.edu>
- Sender: news@news.ysu.edu (Usenet News Admin)
- Nntp-Posting-Host: yfn.ysu.edu
- Organization: Youngstown State University/Youngstown Free-Net
- Date: Fri, 8 Jan 1993 02:58:36 GMT
- Lines: 20
-
-
- NetHeads,
-
- I would like to limit the output length of a string sent to an
- output stream. For example, given a string...
-
- const char *Bob = "1234567890ABCDEF";
-
- are there any manipulators or combination of manipulators which
- would allow
-
- cout << [manip [manip [...]]] << Bob;
-
- to output "12345"? I have tried combinations of setw(), setfill(),
- and setprecision() to no avail. Anyone know what will? Or am I
- resigned to either a) limiting the string length itself, or
- b) writing my own manipulator?
-
- -- Jon
- --
-