Article ID: 119393
Article Last Modified on 4/24/2006
/* Compile options needed: none
*/
#include <strstrea.h>
void main()
{
char buffer[10] = "08";
int i;
istrstream* str;
str = new istrstream( buffer, 10 );
// The following extraction is made with the expectation that
// the i will be set to 8. However, it will be set to 0.
*str >> i;
// To fix this, change the line to:
// *str >> dec >> i;
cout << "i = " << i << endl;
cout << "str->fail()=" << str->fail() << endl;
delete str;
}
#include "stdafx.h"
#include <strstream>
using namespace std;
void main()
{
char buffer[10] = "08";
int i;
istrstream* str;
str = new istrstream( buffer, 10 );
// The following extraction is made with the expectation that
// the i will be set to 8. However, it will be set to 0.
*str >> i;
// To fix this, change the line to:
// *str >> dec >> i;
cout << "i = " << i << endl;
cout << "str->fail()=" << str->fail() << endl;
delete str;
}Additional query words: kbVC400bug 8.00 8.00c 9.00 9.10
Keywords: kbbug kblangcpp KB119393