请问LPCTSTR转char*的问题 请问我要把LPCTSTR a="Hello"传入一个myfunc(char* b);该怎么转换呢我直接使用 myfunc((char*)a);在myfunc内只会看到传入一个'H' 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CString cstr;char *p = (LPSTR)(LPCTSTR)cstr;类型转换 CString cstr;char *p = (LPSTR)(LPCTSTR)cstr;类型转换 CString cstr;char *p = (LPSTR)(LPCTSTR)cstr;类型转换 char* WCharToChar(LPCWSTR lpwStr){ char* pElementText; int iTextLen; iTextLen = WideCharToMultiByte( CP_UTF8,0,lpwStr,-1,NULL,0,NULL,NULL ); pElementText = new char[iTextLen + 1]; memset( ( void* )pElementText, 0, sizeof( char ) * ( iTextLen + 1 ) ); ::WideCharToMultiByte( CP_UTF8,0,lpwStr,-1,pElementText,iTextLen,NULL,NULL); return pElementText;}char * pchar = WCharToChar(a);myfunc(pchar);delete [] pchar; opencv关于视频中画矩形的问题???求高手 VC2005 怎么快速删除用不到的方法! 新手请教简单问题:动态分配数组的问题 如何知道网站是支持几线程的? 怎样去一步步分析一个大的vc程序 最近遇到一个标准件库的问题,不只大虾谁能解决? 关于GlobalAlloc的问题 高分求助!!!!!!!!!!!!!!!!! 300分请问共享软件InstallShield for Windows Installer (版本号:V2.03简版)的密码? 如何实现网络定时传输文件??? VS2010编写了一个加载AVI的对话框,小问题 mfc access数据库程序 ,发布问题
类型转换
类型转换
类型转换
{
char* pElementText;
int iTextLen;
iTextLen = WideCharToMultiByte( CP_UTF8,0,lpwStr,-1,NULL,0,NULL,NULL );
pElementText = new char[iTextLen + 1];
memset( ( void* )pElementText, 0, sizeof( char ) * ( iTextLen + 1 ) );
::WideCharToMultiByte( CP_UTF8,0,lpwStr,-1,pElementText,iTextLen,NULL,NULL);
return pElementText;
}char * pchar = WCharToChar(a);
myfunc(pchar);
delete [] pchar;