Generate a random unicode string
问题 In VS2010, this function below prints "stdout in error state", I'm unable to understand why. Any thoughts on what I'm doing wrong? void printUnicodeChars() { const auto beg = 0x0030; const auto end = 0x0039; wchar_t uchars[end-beg+2]; for (auto i = beg; i <= end; i++) { uchars[i-beg] = i; // I tried a static_cast<wchar_t>(i), still errors! } uchars[end+1] = L'\0'; std::wcout << uchars << std::endl; if (!std::wcout) { std::cerr << std::endl << "stdout in error state" << std::endl; } else { std