这样应该可以wstring ws;......TCHAR* t = (TCHAR*)(&ws[0]);楼主试试看。#include #include using namespace std;int main(){ string s; wstring ws; ws = L"OK"; TCHAR *tc = (TCHAR *)(&ws[0]); return 0;}测试没有报错。 祝你好运!
const TCHAR *t = ws.c_str();