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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -