Check your original topic. matsp provided the way to use stringstream.