what is this? cin.unsetf(ios::skipws);

cin.unsetf(ios::skipws);

what is this and how is it used? we had this exercise and the teacher used it to extract characters...but he didnt much explain..why couldn't we just getline?
there must surely be a reason he used that...thanks
it's the longer way to write cin >> noskipws
it stops formatted input operations from skipping leading whitespace, so if you have a char c;, then cin >> noskipws >> c; becomes equivalent to cin.get(c), that is, read the next character even if it's space or newline
Last edited on
Topic archived. No new replies allowed.