bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hang in ostrstream::operator<<(int n)


From: André Pönitz
Subject: Re: hang in ostrstream::operator<<(int n)
Date: 15 Jan 2002 09:08:01 GMT

Geoff Alexander <address@hidden> wrote:
>   // This method converts int to string and returns string
>   string ModCmvc::StringUtilities::intToString(int num)
>   {
>     ostrstream intStream;
>     intStream << num << ends;
>     string intAsString = intStream.str();
>     return intAsString;
>   }

You have to freeze(0) the stream unless you want to leak (if I am not
mistaken). But that's probably not the problem.
 
> The code is compiled using gcc 2.95.2 on SuSE Linux 7.0 for x386.  Is
> this a known problem or is there something wrong with my code?

Looks ok. But maybe you should try ostringstream from <sstream> instead
of ostrstream as workaround. They don't have that "leak issue" and
strstreams are deprecated anyway. Maybe your problem magically goes
away....

Andre'

-- 
André Pönitz .............................................. address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]