1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
// skipws flag example
#include <iostream> // std::cout, std::skipws, std::noskipws
#include <sstream> // std::istringstream
int main () {
char a, b, c;
std::istringstream iss (" 123");
iss >> std::skipws >> a >> b >> c;
std::cout << a << b << c << '\n';
iss.seekg(0);
iss >> std::noskipws >> a >> b >> c;
std::cout << a << b << c << '\n';
return 0;
}
| |