question about skipws manipulator

Discussion in 'C++' started by thomas, Nov 5, 2008.

  1. thomas

    thomas Guest

    // 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;
    }
    ----------------------------
    I expected the above code will output " ,one.two",
    but it is ",."
    I think a=" "; -> noskipws
    b="one"; --> skipws
    c="two"; --> skipws

    Anything I missed?
     
    thomas, Nov 5, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. berkay

    skipws

    berkay, Sep 20, 2005, in forum: C++
    Replies:
    1
    Views:
    482
    mlimber
    Sep 20, 2005
  2. Norman Landis

    skipws and <<

    Norman Landis, Dec 13, 2005, in forum: C++
    Replies:
    2
    Views:
    1,126
    Simon Biber
    Dec 14, 2005
  3. barcaroller

    Manipulator question...

    barcaroller, May 23, 2007, in forum: C++
    Replies:
    9
    Views:
    442
  4. George2

    Skipws

    George2, Mar 3, 2008, in forum: C Programming
    Replies:
    0
    Views:
    488
    George2
    Mar 3, 2008
  5. thomas

    skipws manipulator

    thomas, Nov 5, 2008, in forum: C++
    Replies:
    0
    Views:
    407
    thomas
    Nov 5, 2008
Loading...

Share This Page