国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
將CString類轉(zhuǎn)換成char*類型
使用強制轉(zhuǎn)換。例如:

CString       theString(       "This       is       a       test "       );
LPTSTR       lpsz       =(LPTSTR)(LPCTSTR)theString;          
char       *buf;      
CString       str       =       "hello ";      
buf       =       (LPSTR)(LPCTSTR)str;
 
CString   str   =   "ABC ";
char*   chArr;
chArr   =   (char*)(LPCTSTR)str;
CString   str( "50 ");
int   nConv   =   atoi(   str   );

使用strcpy。例如:

CString       theString(       "This       is       a       test "       );
LPTSTR       lpsz       =       new       TCHAR[theString.GetLength()+1];
_tcscpy(lpsz,       theString);    
 
char   szBuff[100];
CString   str   =   "123456abc ";
strncpy(   szBuff,   str,   strlen(   str   )   ); 
 或
strncpy(szBuff, str, str.GetLength());   //不要+1了,防越界

使用CString::GetBuffer。例如:

CString       s(_T( "This       is       a       test       "));
LPTSTR       p       =       s.GetBuffer();
//       在這里添加使用p的代碼
if(p       !=       NULL)       *p       =       _T( '\0 ');
s.ReleaseBuffer();      
//       使用完后及時釋放,以便能使用其它的CString成員函數(shù)    
 
CString   str( "this   is   a   test! ");
char*   szBuf   =   str.GetBuffer(   str.GetLenghth()   );
//......
str.ReleaseBuffer();
 
 
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
CString類轉(zhuǎn)換成char*(LPSTR)類型
CString常用方法一_無處&&心靈
【轉(zhuǎn)】char*與LPCTSTR,LPTSTR的轉(zhuǎn)換
字符串轉(zhuǎn)換 BSTR/LPSTR/LPWSTR/Char
BSTR、char*和CString轉(zhuǎn)換
GetBuffer--ReleaseBuffer問題
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服