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

Jan 2, 2013 at 12:23pm
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
Jan 2, 2013 at 12:36pm
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 Jan 2, 2013 at 12:37pm
Topic archived. No new replies allowed.