#include <Windows.h> #include <atlbase.h> #include <iostream> int main(int argc,char *argv[]) { USES_CONVERSION; LPCSTR a = "hello"; LPCWSTR w = A2W(a); std::wcout << w << std::endl; return 0; }
当函数退出时,将释放由A2W(ANSI到Wide)分配的任何内存.