VC6.0下语句:
BOOL CMy3DSLoaderView::OpenFile(LPCTSTR lpszPathName)
{
char* file = new char[strlen(lpszPathName)];
strcpy(file, lpszPathName); //file内容被正确传递
...
}
VS下函数内容我修改为:
{
char* file = new char[strlen((char*)lpszPathName)];
strcpy(file, (const char*)lpszPathName); //file内容不正确
...
}
该如何修改,求解!
因为字符集不一样,lpszPathName是unicode字符指针了。
TCHAR* file = new TCHAR[_tcslen(lpszPathName)];
_tcscpy(file, lpszPathName); //file内容被正确传递