0
當建立我的C++應用程序的構建在這行代碼C++如何在函數調用中將char *轉換爲unsigned char *?
if (!PyTuple_GetByte(poArgs, 0, &SourceCell.window_type))
與此錯誤
錯誤C2664失敗: 'PyTuple_GetByte':不能轉換參數3從 '字符*' 到'無符號字符*」
這是被調用的函數:
bool PyTuple_GetByte(PyObject* poArgs, int pos, unsigned char* ret);
第三個參數&SourceCell.window_type
是char
類型。
有沒有辦法轉換/施放該參數的函數調用裏面像
if (!PyTuple_GetByte(poArgs, 0, reinterpret_cast<unsigned char*>(&SourceCell.window_type)))
還是我必須用另一種方式來處理呢?
試試看..... – knivil
一個'static_cast'應該正常工作IIRC。 –
'if(!PyTuple_GetByte(poArgs,0,reinterpret_cast(&SourceCell.window_type)))'不起作用嗎? –
NathanOliver