I am try to use an ifstream
with the while loop to get each value. However, when I try it, nothing happens. Why?
std::string line;
std::getline(cin, line);
std::ifstream stream(line);
while(stream){
std::cout << stream.get();
}
I am try to use an ifstream
with the while loop to get each value. However, when I try it, nothing happens. Why?
std::string line;
std::getline(cin, line);
std::ifstream stream(line);
while(stream){
std::cout << stream.get();
}
You must use an istringstream
, not an ifstream
.