Javatpoint Logo
Javatpoint Logo

C++ Manipulator skipws

C++ manipulator skipws() function is used to set the skipws format flag for the str stream.

When we set skipws format flag, then it skips any number of whitespaces before the next input. Tab spaces, blank spaces and carriage returns are considered whitespaces.

This applies to any formatted input operation performed with operator >> on the stream.

Syntax

Parameter

str: stream object whose format flag is affected.

Return value

It returns argument str.

Data Races

Data races may cause when modifies str concurrent access to the same stream object.

Exceptions

str is in a valid state, if an exception is thrown.

Example 1

Let's see the simple example to demonstrate the use of skipws:

Output:

123
  1

Example 2

Let's see another simple example:

Output:

After using skipws c =  
After using ws c = 1

Example 3

Let's see another simple example:

Output:

Default behavior: c1 = a c2 = b c3 = c
noskipws behavior: c1 = a c2 =   c3 = b
Next TopicC++ Manipulator





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA