找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 3531|回復(fù): 0
收起左側(cè)

sting\CString\char*(LPSTR)之間的轉(zhuǎn)換

[復(fù)制鏈接]
ID:51269 發(fā)表于 2014-11-10 22:59 | 顯示全部樓層 |閱讀模式
  1、CString到string: string=(LPCTSTR)CString;

  2、string到CString: CString=string.c_str();

  3、Char到CString:   Format;

  4、CString到char*:  LPTSTR lpsz =(LPTSTR)(LPCTSTR)theString; 還可以:strcpy(lpsz, theString);還可以:LPTSTR lpsz = theString.GetBuffer(),但在使用過(guò)后要用theString.ReleaseBuffer(),及時(shí)釋放,以便能使用其它的CString成員函數(shù) ;
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表