You are performing formatted input and after extracting i out of the string-stream the eofbit is set. Hence you have to clear the state or all following formatted input/output will fail.
#include <sstream>
#include <iostream>
int main()
{
std::stringstream s;
s << std::hex;
int i;
s << "100";
s >> i; // 256
std::cout << i << '\n';
s.clear(); // clear the eofbit
s << "10";
s >> i; // 16
std::cout << i << '\n';
return 0;
}