看板 C_and_CPP 關於我們 聯絡資訊
我在說明一下好了@@ 有一個字串 CString team; team = _T("BOS"); 然後我的傳送buff第4~6是隊名 team.Mid(0,1)-->"B"....... 本來想說用 outbuff[4] = (LPCSTR)team.Mid(0,1); 但會出現 cannot convert from 'const char *' to 'unsigned char'的錯誤 ※ 引述《timohu ( )》之銘言: : 我是用MFC在寫一個視窗程式 : 因為在通訊部分是用數字再傳的 : ex: : outbuff[0] = 0xA; : outbuff[1] = 0xB;....... : 假設現在outbuff[4~6]是"BOS" 這樣的資料 : 那我要用什麼方法讓 : outbuff[4] = 0x42; : outbuff[5] = 0x4f; : outbuff[6] = 0x53; : (我是用WriteFile()把資料傳送出去的) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.87.152.131
fuha:錯誤訊息不是寫的很清楚了嗎? 另外你要注意你的字串是_T() 02/13 17:24
akasan:outbuff[4] = *(LPCSTR)team.Mid(0,1); 02/13 17:32