Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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.

A reference to the object from which _Str is derived.

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.

// 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;   
}

1 2 3

.1.
..
..

Header: <ios>

Community Additions

ADD
Show:
© 2015 Microsoft