std::skipws, std::noskipws

Header: <ios>

Enables or disables skipping of leading whitespace by the formatted input functions (enabled by default). Has no effect on output.

# Declarations

std::ios_base& skipws( std::ios_base& str );
std::ios_base& noskipws( std::ios_base& str );

# Parameters

# Return value

str (reference to the stream after manipulation).

# Example

#include <iostream>
#include <sstream>
 
int main()
{
    char c1, c2, c3;
    std::istringstream("a b c") >> c1 >> c2 >> c3;
    std::cout << "Default  behavior:"
                 " c1 = " << c1 << 
                 " c2 = " << c2 << 
                 " c3 = " << c3 << '\n';
    std::istringstream("a b c") >> std::noskipws >> c1 >> c2 >> c3;
    std::cout << "noskipws behavior:" 
                 " c1 = " << c1 <<
                 " c2 = " << c2 <<
                 " c3 = " << c3 << '\n';
}

# See also