C++ Manipulator wsC++ manipulator ws function is used to discard leading whitespace from an input stream. This function extracts as many whitespace characters as possible from the current position in the input sequence. This extraction stops as soon as a non-whitespace character is found. These extracted whitespace characters are discarded. SyntaxParameteris: Input stream object from where whitespace are extracted. Return valueIt returns argument is. Data RacesModifies the stream object is. If we try to concurrent access to the same stream object then it may cause data races, except for the standard stream objects cin and wcin when these are synchronized with stdio. ExceptionsObject is in a valid state, if any exception is thrown. Example 1Let's see the simple example to demonstrate the use of istream ws: Output: java, Tpoint Example 2Let's see another simple example: Output: ws + getline returns: "JavaTPoint tutorial" Example 3Let's see another simple example: Output: Hello!! Please, enter some whitespaces followed by a sentence: Myself Nikita kesharwani Please, enter some whitespaces followed by a sentence: You wrote: Hello!! Myself Nikita Kesharwani
Next TopicC++ Manipulator
|