CSTRING LPCTSTR LPTSTR Type of Transformation

xiaoxiao2021-03-06  44

CSTRING LPCTSTR LPTSTR Type of Transformation

// 変 number definition

LPTSTR S_T;

LPCTSTR S_CT;

CString Str;

Cstring SResult;

Const I_CT = 5;

INT i = 10;

Const Int * p_ct = & i_ct;

INT * P = & I;

// メ メ ド ド 1. CString -> LPTSTR

// Initialization す す S_T = "null"; s_ct = "null"; str = "secbug"; // 変 S_T = (lptstr) (LPCTSTR) STR;

/ / The result is す

SResult = CString ("Turn CString から LPTSTR, OK:") S_T;

MessageBox (SResult);

// メ メ ド ド 2. CSTRING -> LPCTSTR

// Initialization S_T = "null"; s_ct = "null"; str = "secbug"; // 変 す S_CT = STR;

/ / The result SResult = CString ("Turn CString から lpctstr, OK:") S_CT; MessageBox (SRESULT);

// メ メ ド ド 3. LPCTSTR -> LPTSTR

// Initialization S_T = "NULL"; s_ct = "null"; str = "secbug"; // 変 す S_CT = Str; // s_t = s_ct; // error, The Same with p = p_ct;

/ / The result SRESULT = CString ("Turn LPCTSTR から LPTSTR, NG"); MessageBox (SRESULT);

// メ メ ド ド 4. LPTSTR -> LPCTSTR

// Initialization S_T = "sec"; s_ct = "bug"; str = "secbug"; // 変 す す S_CT = S_T; // Wright, The Same with p_ct = P;

/ / The result is SRESULT = CSTRING ("Turn LPTSTR から LPCTSTR, OK") S_CT; MessageBox (SRESULT);

Somewhere

http://www.xoeo.com/htmldata/2004_08/2/Article_65_1.html

转载请注明原文地址:https://www.9cbs.com/read-79461.html

New Post(0)