From -2698145983738764634
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,4a10029849950019
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-08-08 23:17:35 PST
Newsgroups: comp.std.c++
Path: bga.com!news.sprintlink.net!sun.cais.com!io.org!uunet.ca!uunet.ca!scipio.cyberstore.ca!vanbc.wimsey.com!deep.rsoft.bc.ca!sol.ctr.columbia.edu!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!news.duke.edu!concert!decwrl!borland.com!pete
From: pete@genghis.interbase.borland.com (Pete Becker)
Subject: Re: strstreams and string classes
Message-ID: <Cu8sL4.Arw@borland.com>
Sender: news@borland.com (News Admin)
Organization: Borland International
References: <MATT.94Aug7002700@physics2.berkeley.edu>
Date: Tue, 9 Aug 1994 00:41:28 GMT
Lines: 30

In article <MATT.94Aug7002700@physics2.berkeley.edu>,
Matt Austern <matt@physics.berkeley.edu> wrote:
>strstream, istrstream, and ostrstream allow formatted I/O to and from
>strings, instead of output devices.  They require a fairly complicated
>memory allocation protocol, though, which is related to the fact that
>the "strings" they use are C-style strings, i.e., arrays of chars
>terminated by '\0'.

	Actually, it's easy:

	char buf[256];
	ostrstream out( buf, sizeof buf );

	No need to mess with freeze() and unfreeze(). But if the results of
your manipulations of the stream exceed the buffer size, the output will be
truncated.

>
>This makes sense if C-style strings are the only sort of strings we
>have to work with, but it doesn't really make much sense if there's
>any other alternative.  C-style strings are awfully low level in quite
>a few ways.
>
>My question, then: given that the C++ standard class library will
>include a string class, will the standard include an iostream class
>that uses these strings?
>

	Yes.
	-- Pete


