Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: std::ostringstream unexpected behavior with .net 2003.

Reply
Thread Tools

Re: std::ostringstream unexpected behavior with .net 2003.

 
 
Victor Bazarov
Guest
Posts: n/a
 
      06-25-2003
"Nathalie D'Amours" <(E-Mail Removed)> wrote...
> I am using Microsoft VC .net 2003 and the std:stringstream seams to

behave
> in an unexpected way.
>
> int i = 3;
> std:stringstream os;
> os << i << std::ends;
> std::string s1 = os.str();
> std::string s2("3");
> bool result = (s1 == s2);
>
> When I execute this code, 'result' gets set to false. Obviously I am
> expecting the strings to be identical. I've stepped in the comparison

code
> and the internal call to ::strcmp correctly returns 0 but then there is

some
> logic to compare the string lengths and they differ. s1 size is 2 and s2
> is 1 and this is why the comparison function returns false.
>
> This seems buggy to me. Am I missing something?


Yes. Drop the "<< std::ends".

> Has anyone else seen the
> same problem?


Probably. I haven't.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unexpected page designer behavior Chuck Bowling ASP .Net 1 07-04-2005 02:06 PM
Unexpected datagrid behavior G Dean Blake ASP .Net 0 01-13-2005 04:56 PM
Unexpected Python Behavior Simon Wittber Python 30 10-05-2004 09:21 PM
Unexpected (by me) exec behavior Mark Wright Python 0 07-08-2003 03:18 PM
Re: std::ostringstream unexpected behavior with .net 2003. Russell Hanneken C++ 0 06-25-2003 10:22 PM



Advertisments