DWORD code = sizeof (DWORD), dwBytesWritten = sizeof (code);
::HttpQueryInfo(hResourceHandle, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &code, &dwBytesWritten, NULL);
qDebug() << "status code:" << code;
DWORD baval = sizeof(DWORD);
::InternetQueryDataAvailable(hResourceHandle, &baval, NULL, NULL);
qDebug() << "Bytes Available:" << baval;
char szBuffer[256];
DWORD dwNumberOfBytesRead = 1;
while(dwNumberOfBytesRead){
if(::InternetReadFile(hResourceHandle, szBuffer, sizeof(szBuffer),&dwNumberOfBytesRead)){
if(dwNumberOfBytesRead == 0) break;
//qDebug() << QByteArray( szBuffer, dwNumberOfBytesRead );
//szBuffer[dwNumberOfBytesRead] = 0;
qDebug() << "BytesRead" << dwNumberOfBytesRead;
str.append(szBuffer);
/*
for(int i= 0; i<= (int)dwNumberOfBytesRead; i++){
str += QString(szBuffer[i]);
}*/
qDebug() << "current str.length()" << str.length();
}
else{ qDebug() << "error:" << GetLastError(); }
}
bbb.append(str);
file->write(bbb);
file->close();
}
else{
qDebug() << "dwErrorCode" << GetLastError();
}
qDebug() << "complete response" << str;
qDebug() << "length" << str.length();
DWORD code = sizeof (DWORD), dwBytesWritten = sizeof (code);
::HttpQueryInfo(hResourceHandle, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &code, &dwBytesWritten, NULL);
qDebug() << "status code:" << code;
DWORD baval = sizeof(DWORD);
::InternetQueryDataAvailable(hResourceHandle, &baval, NULL, NULL);
qDebug() << "Bytes Available:" << baval;
char szBuffer[256];
DWORD dwNumberOfBytesRead = 1;
while(dwNumberOfBytesRead){
if(::InternetReadFile(hResourceHandle, szBuffer, sizeof(szBuffer),&dwNumberOfBytesRead)){
if(dwNumberOfBytesRead == 0) break;
//qDebug() << QByteArray( szBuffer, dwNumberOfBytesRead );
//szBuffer[dwNumberOfBytesRead] = 0;
qDebug() << "BytesRead" << dwNumberOfBytesRead;
str.append(szBuffer);
/*
for(int i= 0; i<= (int)dwNumberOfBytesRead; i++){
str += QString(szBuffer[i]);
}*/
qDebug() << "current str.length()" << str.length();
}
else{ qDebug() << "error:" << GetLastError(); }
}
QFile *file = new QFile("log");
file->open(QIODevice::WriteOnly);
QByteArray bbb;
bbb.append(str);
file->write(bbb);
file->close();
}
else{
qDebug() << "dwErrorCode" << GetLastError();
}
qDebug() << "complete response" << str;
qDebug() << "length" << str.length();
To copy to clipboard, switch view to plain text mode
Bookmarks