skipws manipulator

T

thomas

// ws manipulator example
#include <iostream>
#include <sstream>
using namespace std;

int main () {
char a[10], b[10], c[10];

istringstream iss (" one \n \t two");
iss >> noskipws;
iss >> a >> skipws >> b >> c;
cout << a << "," << b <<"."<<c<< endl;

return 0;
}
--------------
output: ",."
I expected: " ,one.two";
a=" " (noskipws)
b="one"(skipws)
c="two"(skipws)

Anything I missed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top