You don't need to use stringstream, its much easier than that, just cast to unsigned char (in case you have any chars with a negative encoding) and then to int.
cout << "Integer value: ";
for (size_t i = 0 ; i < msg.size(); ++i)
cout << static_cast<int>(static_cast<unsigned char>(msg[i]));
cout << "\n";
Every character is encoded by an integer, which just happens to be the integer you want. So you can do the conversion with a simple cast.