當HTTP發佈數據;如果我使用std::wstring
作爲參數,則不會發布所有文本。但是如果我使用標準的TCHAR數組,那麼所有的文本都會被髮布。爲什麼會發生這種情況,我如何繼續使用std::wstring
?在WinAPI函數中使用std :: wstring:並非所有文本都發送
// wont compile unless cast to LPVOID and not all data is sent.
HttpSendRequest(hRequest, hdrs, -1, (LPVOID)fData.c_str(), fData.size());
// successfully sends all fData text
TCHAR s[1024] = {0};
_tcscpy(s, fData.c_str());
HttpSendRequest(hRequest, hdrs, -1, s, sizeof(s));
「不會編譯除非投地LPVOID」告訴你,你錯了類型。 –
@ Cheersandhth.-Alf函數4th參數需要'LPVOID',即void指針。一個void指針可以是任何類型。 –
'HttpSendRequest'應該使用'fData.size()* 2',如果是'std :: wstring' –