Advertisement
loloof64

Cpp problems with locale and wcout

Mar 20th, 2013
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale>
  3.  
  4. int main(){
  5.     using namespace std;
  6.     locale loc (
  7.     locale (),
  8.     new codecvt_byname<wchar_t, char, mbstate_t>(""));
  9.  
  10.     wcin.imbue(loc);
  11.     wcout.imbue(loc);
  12.    
  13.     wchar_t aChar;
  14.     cout << "Enter your char : ";
  15.     wcin >> aChar;
  16.     bool status = wcin.good();
  17.     cout << "WCIN status " << status << endl;
  18.    
  19.     wcout << L"You entered " << aChar << L" .\n";
  20.     status = wcout.good();
  21.     cout << "WCOUT status " << status << endl;
  22.    
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement