#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
#include <sstream>
using std::istringstream;
int main()
{
string input( "" );
istringstream inputString( input );
// attempt to read from empty stream
long value;
inputString >> value;
if ( inputString.good() )
cout << "\n\nlong value is: " << value << endl;
else
cout << "\n\ninputString is empty" << endl;
return 0;
}
|