bug in istringstream::str(string)

Haruhiko Okumura okumura@matsusaka-u.ac.jp
Sat Apr 1 00:00:00 GMT 2000


"Gerd v. Egidy" <egidy@deam.de> wrote:

> istringstream is;
> string base="123";
> int a,b;
> 
> is.str(base);
> is >> a;
> cerr << a << "\n";   // output is 123
> 
> is.str(base);
> is >> b;
> cerr << b << "\n";   // output is 1073784336 (or some other strange value)

"is.clear();" before the second "is.str(...)" might help.

-- 
Haruhiko Okumura <okumura@matsusaka-u.ac.jp>
Matsusaka University, 1846 Kubo-cho, Matsusaka, 515-8511 Japan
Phone: +81-598-29-1122  Fax: +81-598-29-1014
http://www.matsusaka-u.ac.jp/~okumura/


More information about the Libstdc++ mailing list