User forums > General (but related to Code::Blocks)
istringstream : bug @ MS
killerbot:
Very very off topic, in the case I did not do anything wrong, I have found a bug in M$ DevStudio 2005. And off course things work well in Code::Blocks :lol: :lol: :lol: :lol:
--- Code: ---#include <string>
#include <sstream>
#include <iostream>
using namespace std;
int main()
{
string FirstWord("267,45");
istringstream iss2(FirstWord);
int x = 0;
iss2 >> x; //<------------------------------ M$ goes wrong here
char Comma = 0;
iss2 >> Comma;
if(Comma != ',')
{
return -1;
}
int y = 0;
iss2 >> y;
cout << x << "," << y << endl;
} // end of main
--- End code ---
The code above, fails to read in the integer value into x (.NET 2003 did it OK), the stream even goes in to 'fail' or 'bad' state, since later on even reading a char is no longer possible. (If you start with a char, then you would get the '2').
So, once more, in case I did not do anything wrong, beware of using M$, USE CB.
Excuse me , what did you say --> USE CB. :twisted: :twisted:
mandrav:
Are you serious? Streaming to an integer fails?
LOL :lol:
killerbot:
damn right, at least from an istringstream.
AkiraDev:
Good grief. How on Earth did this get past the Beta testing?
Is this "the most compliant compiler"? :?
sethjackson:
:lol: :lol: :lol: That is M$ for you. Not to metion their IDE's are slow and bloated...... Needless to say C::B isn't bloated. :D USE C::B.
Navigation
[0] Message Index
[#] Next page
Go to full version