![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C) Example: Http.DownloadSb methodSee more HTTP ExamplesDemonstrates theDownloadSb method.
#include <C_CkHttpW.h> #include <C_CkStringBuilderW.h> void ChilkatSample(void) { BOOL success; HCkHttpW http; HCkStringBuilderW sb; int statusCode; success = FALSE; http = CkHttpW_Create(); CkHttpW_putKeepResponseBody(http,TRUE); sb = CkStringBuilderW_Create(); success = CkHttpW_DownloadSb(http,L"https://chilkatsoft.com/testData/helloWorld.txt",L"utf-8",sb); statusCode = CkHttpW_getLastStatus(http); if (success == FALSE) { if (statusCode == 0) { // Unable to either send the request or get the response. wprintf(L"%s\n",CkHttpW_lastErrorText(http)); } else { // We got a response, but the status code was not in the 200s wprintf(L"Response status code: %d\n",statusCode); // Examine the response body. wprintf(L"Response body:\n"); wprintf(L"%s\n",CkHttpW_lastResponseBody(http)); } wprintf(L"Download failed.\n"); } else { wprintf(L"Download success, response status = %d\n",statusCode); wprintf(L"%s\n",CkStringBuilderW_getAsString(sb)); } CkHttpW_Dispose(http); CkStringBuilderW_Dispose(sb); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.