Start New Discussion within our Software Development Community

I have asked StackOverflow, compared my code to multiple different online sources, but I still cannot get the page status from the server.

The library I am using is Wininet, and the function failing to retrieve the correct data is HttpQueryInfo. I am linking against wininet.


int statusCode;
    DWORD statCharLen = 128;
    char statChar[statCharLen];

    //Check existance of page (for 404 error)
        return 4;
    statusCode = atoi(statChar);

    if(statusCode == 404)
        cout << "We got a 404 error" << endl;

    cout << "Stat code text : " << statChar << endl;
    cout << "Stat code num  : " << statusCode << endl;
    cout << "404 status code: " << HTTP_STATUS_NOT_FOUND << endl;

The problem is I am not able to retrieve a status code; the query simply returns a 1 byte char array containing "0". I am not sure what to make of this (by the way, this code was semi-influenced by one of the stackoverflow answers, but still does not work).

Thanks for your help!
If I was unclear about anything comment and I'll fix it.

So, no one?
This seems like a difficult question, or maybe I just worded it wrong, but its been a week now and SO hasn't been able to answer it either.

This article has been dead for over six months. Start a new discussion instead.