共用方式為


noskipws

Cause spaces to be read by the input stream.

ios_base& noskipws(
   ios_base& _Str
);

Parameters

  • _Str
    A reference to an object of type ios_base, or to a type that inherits from ios_base.

Return Value

A reference to the object from which _Str is derived.

Remarks

By default, skipws is in effect. When a space is read in the input stream, it signals the end of the buffer.

The manipulator effectively calls _Str.unsetf(ios_base::skipws), and then returns _Str.

Example

// ios_noskipws.cpp
// compile with: /EHsc
#include <iostream>
#include <string>

int main() {
   using namespace std;   
   string s1, s2, s3;
   cout << "Enter three strings: ";
   cin >> noskipws >> s1 >> s2 >> s3;
   cout << "." << s1  << "." << endl;
   cout << "." << s2 << "." << endl;
   cout << "." << s3 << "." << endl;   
}

Input

1 2 3

Sample Output

.1.
..
..

Requirements

Header: <ios>

Namespace: std

See Also

Concepts

<ios> Members

iostream Programming

iostreams Conventions