Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Unicode C++ Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
FileAccess
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)

Java KeyStore (JKS)
Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(Unicode C++) Get a Piece of Information from the LastErrorXml

Demonstrates how to get a bit of information from the LastErrorXml. Suppose you call ftp.DeleteRemoteFile and it fails, and the LastErrorXml property contains the XML as shown below. This example gets the content in the "statusCode" tag.

<ChilkatLog>
  <DeleteRemoteFile>
    <DllDate>Dec 30 2015</DllDate>
    <ChilkatVersion>9.5.0.55</ChilkatVersion>
    <UnlockPrefix>xxx</UnlockPrefix>
    <Username>CHILKAT:Matt</Username>
    <Architecture>Little Endian; 32-bit</Architecture>
    <Language>Visual C++ 11.0 (32-bit)</Language>
    <VerboseLogging>0</VerboseLogging>
    <filename>[does_not_exist.txt]</filename>
    <deleteFile>
      <simplePathCommand>
        <simpleCommand>
          <sendCommand>
            <sendingCommand>DELE does_not_exist.txt</sendingCommand>
          </sendCommand>
          <readCommandResponse>
            <replyLineQP>550 Delete operation failed.</replyLineQP>
          </readCommandResponse>
        </simpleCommand>
        <error>Simple path command failed.</error>
        <statusCode>550</statusCode>
        <reply>550 Delete operation failed.</reply>
      </simplePathCommand>
    </deleteFile>
    <error>Failed.</error>
  </DeleteRemoteFile>
</ChilkatLog>

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Win Mobile 5.0/Pocket PC 2003

Solaris C/C++

FreeBSD C/C++

OpenBSD C/C++

MinGW C/C++

#include <CkFtp2W.h>
#include <CkXmlW.h>

void ChilkatSample(void)
    {
    CkFtp2W ftp;

    bool success;

    //  Any string unlocks the component for the 1st 30-days.
    success = ftp.UnlockComponent(L"Anything for 30-day trial");
    if (success != true) {
        wprintf(L"%s\n",ftp.lastErrorText());
        return;
    }

    ftp.put_Hostname(L"ftp.***.com");
    ftp.put_Username(L"***");
    ftp.put_Password(L"***");

    //  Connect and login to the FTP server.
    success = ftp.Connect();
    if (success != true) {
        wprintf(L"%s\n",ftp.lastErrorText());
        return;
    }

    //  Set the current remote directory to where the file is located:
    success = ftp.DeleteRemoteFile(L"does_not_exist.txt");
    if (success != true) {
        CkXmlW xml;
        success = xml.LoadXml(ftp.lastErrorXml());
        success = xml.SearchForTag2(null,L"statusCode");
        if (success == true) {
            wprintf(L"statusCode = %s\n",xml.content());
        }

        return;
    }

    success = ftp.Disconnect();

    }

 

© 2000-2016 Chilkat Software, Inc. All Rights Reserved.