Unicode C++
Unicode C++
Example: Http.QuickGetSb method
Demonstrates theQuickGetSb method.
Chilkat Unicode C++ Downloads
#include <CkHttpW.h>
#include <CkStringBuilderW.h>
void ChilkatSample(void)
{
bool success = false;
CkHttpW http;
// Send the HTTP GET and return the content in a StringBuilder
CkStringBuilderW sb;
success = http.QuickGetSb(L"https://www.chilkatsoft.com/helloWorld.json",sb);
if (http.get_LastMethodSuccess() == false) {
if (http.get_LastStatus() == 0) {
// Communications error. We did not get a response.
wprintf(L"%s\n",http.lastErrorText());
}
else {
wprintf(L"Response status code: %d\n",http.get_LastStatus());
wprintf(L"Response body error text:\n");
wprintf(L"%s\n",sb.getAsString());
}
return;
}
// The downloaded content:
wprintf(L"%s\n",sb.getAsString());
wprintf(L"Success\n");
}