IStream的Read和write使用


String^ postData = ref new String(L"vps=1%23android2.2%23sdk%23JS11332819623969119164175006%23128%23480_800%237.1.3&pver=5&funid=4001");

ULONG BytesWritten = 0;
ComPtr<IStream> postStream;

HRESULT hr = S_FALSE;
CreateStreamOnHGlobal(nullptr,true,&postStream);
const wchar_t *pBuf = postData->Data();
int wlen = 2*(postData->Length()+1);
postStream->Write((void*) pBuf, wlen, &BytesWritten);

ULONG uLongRet;
LARGE_INTEGER move;
move.QuadPart = 0;
postStream->Seek(move, STREAM_SEEK_SET, NULL);
wchar_t* pRet = NULL;
pRet = new wchar_t[wlen];
postStream->Read((void*) pRet, BytesWritten, &uLongRet);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM