我有一个宽 char 变量,我想用一个字符串大小对其进行初始化。我尝试了以下但没有奏效。
std::string s = "aaaaaaaaaaaaaaaaaaaaa"; //this could be any length
const int Strl = s.length();
wchar_t wStr[Strl ]; // This throws error message as constant expression expected.
我有什么选择来实现这一目标?malloc 在这种情况下会起作用吗?