开发者

Taking Arabic Character Input in C++ from a console application on Windows

开发者 https://www.devze.com 2023-01-19 09:50 出处:网络
Is the开发者_如何学Cre any example Code showing How to accept Arabic Input from user in C++ on a console application, in windows?I\'ll try answer the C++ part. You cannot read arabic characters from c

Is the开发者_如何学Cre any example Code showing How to accept Arabic Input from user in C++ on a console application, in windows?


I'll try answer the C++ part. You cannot read arabic characters from console with cin. However in <iostream> there's a predeclared wcin object that is of type wistream - a wide-character input stream. And you should read an input not into string but into wstring.

e.g

#include <iostream>
#include <string>
int main()
{
   std::wstring s;
   std::wcin >> s;
}

This was the C++ part, however the question remains whether or not your OS allows wide characters in the console window. HTH

0

精彩评论

暂无评论...
验证码 换一张
取 消