码迷,mamicode.com
首页 > 其他好文 > 详细

char* to LPTSTR

时间:2014-07-07 23:39:23      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:new   ar   har   re   c   css   

1,char* to LPTSTR

LPTSTR Char2LPTSTR(char* mchar)
{
  int length ;
  wchar_t* pWChar;
  length = MultiByteToWideChar (CP_OEMCP, 0, mchar, -1, NULL, 0) ;
  if(length<=0)return NULL;
  pWChar=new wchar_t[length+1];
  memset(pWChar,0,length+1);
  MultiByteToWideChar (CP_OEMCP, 0, mchar, -1, pWChar, length+1) ;
  return pWChar;
}

注意用完后要及时

delete [] pWChar;

2, CString to char* 

char* pmodel=(LPSTR)(LPCTSTR)csSelectedModel;

 

char* to LPTSTR,布布扣,bubuko.com

char* to LPTSTR

标签:new   ar   har   re   c   css   

原文地址:http://www.cnblogs.com/tiancun/p/3812694.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!