c++ - Istream consume at most N whitespace characters -


is possible tell std::istream consume fixed number (namely, 1) of whitespace characters when applying operator>>? have string i'd parse parameters, of parameters empty, causing subsequent calls operator>> fail.

try std::noskipws :

std::cin >> std::noskipws; char ws; std::string firstfield, secondfield, thirdfield; std::cin >> firstfield >> ws >> secondfield >> ws >> thirdfield; 

or, slurp entire line string (see std::getline), , split boost.


Comments