当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' –