c++ - WinInet HttpQuery Info returning Invalid Status Codes -
i working on program needs check existence of page before loads (so nothing exotic).
everything working ok, cannot httpqueryinfo return valid status code page. status code returned is: 1875378224
code producing problem:
dword headerbuffsize = sizeof(dword); dword statuscode; //check existance of page (for 404 error) if(!httpqueryinfo(hrequesthandle, http_query_status_code, &statuscode, &headerbuffsize, null)) return 4; if(statuscode == http_status_not_found) cout << "we got 404 error" << endl; cout << "got status code: " << statuscode << endl; //1875378224 everywhere cout << "404 status code: " << http_status_not_found << endl; //what should getting
i not sure make of it; have compared own code several examples online, , looks should work, although may have made stupid mistake.
thanks!
the information retrieved response header httpqueryinfo
text string.
int statuscode; char responsetext[256]; // change wchar_t unicode dword responsetextsize = sizeof(responsetext); //check existance of page (for 404 error) if(!httpqueryinfo(hrequesthandle, http_query_status_code, &responsetext, &responsetextsize, null)) return 4; statuscode = atoi(responsetext);
Comments
Post a Comment