所以我从运行时传递一个字符串值作为函数参数:
Handle<Value> xObj::Whatever(const Arguments& args){ ... // etc.
args[0]
绝对应该是字符串:
if(!args[0]->IsString()) { ThrowException(... // etc.
现在我们有了它,我如何将它转换成有用的东西,比如 LPCWSTR、wchar_t、char[] 或其他东西?
MessageBox(NULL, args[0], L"Your value, sir.",0); // no way
MessageBox(NULL, args[0]->ToString(), L"Your value, sir.",0); // also no
/// then how?
最佳答案
v8::String::Value(args[0])
可以转换为 uint16_t const*
,它可以转换为 LPCWSTR
。 (这取决于编译器设置/Zc:wchar_t-
)
关于c++ - 将 v8::String 转换为 LPCWSTR?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11132212/