如何将wchar_t*转换为long c ++

use*_*747 2 c++ windows winapi wchar-t visual-c++

正如标题所示,我需要知道在visual c ++中转换wchar_t*为的最佳方式long.有可能吗?如果可能怎么做?

Dea*_*ock 6

使用_wtol()将宽字符串转换为long.

wchar_t *str = L"123";
long lng = _wtol(str);
Run Code Online (Sandbox Code Playgroud)