Skip to main content
GameDev.net gamedev.net
🔒 Locked

Streams...

Started by Max_Payne Feb 2, 2004 at 5:33 PM 1 replies 450+ views
Original Post
Max_Payne
Max_Payne
So I''m using std::stringstream in a templated class. I was wondering... If my stringstream contains a string like "hello", and I try to do mystring >> integer variable, what happens. I already know it wont work, and that it wont crash, but does the stringstream object set some sort of error value somewhere to indicate that the output failed, or is the only option to compare the integer with its original value to see if it changed?

Looking for a serious game project?
www.xgameproject.com

Looking for a serious game project?
www.xgameproject.com
SiCrane
SiCrane
Like any basic_istream class, std::stringstream will set the fail bit if an extraction operator fails. You can check for the fail bit with the fail() member function.

edit: spelling

[edited by - SiCrane on February 2, 2004 6:41:57 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.