iostream - STL C++

wcin

Declaration

extern wistream wcin;

Description

The wcin object is an instantiation of the input stream wistream that controls the stream buffer and is used for standard wide-character input.

Header Include

#include <iostream>

Example

#include <iostream>

int main() {
	using namespace std;

	// Ask a question
	wcout << L"What is your favorite number?" << endl;

	// Get input in wchar_t characters
	int iNumber;
	wcin >> iNumber;

	// Output a message with the input
	wcout << L"Your favorite number is " << iNumber << endl;

	// Keep the window open
	cin.clear();
	cin.ignore(0xFFFFFFFF, '\n');
	cin.get();
	return 0;
}

Output

wcin Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.