Udostępnij za pośrednictwem


skipws

Cause spaces to not be read by the input stream.

ios_base& skipws(
   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. noskipws will cause spaces to be read from the input stream.

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

Example

#include <iostream>
#include <string>

int main( ) 
{
   using namespace std;
   char s1, s2, s3;
   cout << "Enter three characters: ";
   cin >> skipws >> s1 >> s2 >> s3;
   cout << "." << s1  << "." << endl;
   cout << "." << s2 << "." << endl;
   cout << "." << s3 << "." << endl;
}
  1 2 3

FakePre-b391b3ad490b44a5b0e7fac8d2f38986-e2548bb4c34548f1bf3ee6c1cef748b6

Requirements

Header: <ios>

Namespace: std

See Also

Reference

iostream Programming

iostreams Conventions

Other Resources

<ios> Members