c++ - Does this code work universaly, or is it just my system? -
#include <iostream> #include <fstream> #include <string> using namespace std; int main() { locale system(""); locale::global(system); wcin.imbue(system); wstring data; getline(wcin,data); wcout.imbue(system); wcout << data << l" length=" << data.length() << endl; locale utffile("en_us.utf-8"); wofstream file("my_utf_file.txt"); file.imbue(utffile); file << data; file << endl; file.close(); return 0; }
it's system. locale names not part of c++ standard, "en_us.utf-8"
not universally valid. it's not locale similar exists.
Comments
Post a Comment