Ok, so I added the S << std::ends; to each of the stream statements.
This did resolve it on Red hat, however on Solaris for the first
testfunction it did not:

void test1() {
    std::ostringstream S;
    long double x = std::pow(1e300,2);
    S << "Something " <<  std::setprecision(8) << x;
    S << " else";
    S << std::ends;
    std::printf("Test1: %s\n", S.str().c_str()); 
}

On solaris it is printing up until the double and then nothing else is
printed.  However if I change the precision to less then 8 then it works
fine.

Jeremy


-----Original Message-----
From: Martin Sebor [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 25, 2007 11:36 AM
To: stdcxx-dev@incubator.apache.org
Subject: Re: Getting incorrect behavior on strstream

Farid Zaripov wrote:
>> -----Original Message-----
>> From: Jeremy Dean [mailto:[EMAIL PROTECTED]
>> Sent: Friday, June 22, 2007 11:45 PM
>> To: stdcxx-dev@incubator.apache.org
>> Subject: Getting incorrect behavior on strstream
>>
>> I have a testcase that is showing incorrect behavior ostrstream or
>> ostringstream:
> 
> [...]
> 
>> Any thoughts on this problem?
> 
>   ostrstream::str() returns just the beginning pointer to the
sequence.
> The sequence don't
> have the null character unless you especially inserted it. You should 
> print no more that
> otrstream::pcount() characters.
> 
>   See Remarks on the page

Better yet, refer to the stdcxx Class Reference :)

http://incubator.apache.org/stdcxx/doc/stdlibref/strstreambuf.html#idx12
24

Martin

Reply via email to