Chilkat C/C++ libraries now available for MAC OS X

The Chilkat C/C++ libraries are now available for MAC OS X. For the download link and more information, see http://www.chilkatsoft.com/installMacOSX.asp Chilkat will soon release MAC OS X compatible builds for Java, Perl, Python, and Ruby. Following that, builds for the IOS (IPhone) will be released, along with Objective-C/C++ native libraries for both MAC OS X and IPhone.

Very simple C# SSH Shell Console Terminal

Here’s an example that demonstrates a rough start to creating a C# console SSH shell terminal (where the user can type commands and output from the remote command echos to the console: using System; using System.Collections.Generic; using System.Text; using System.IO; namespace SshTerminalConsole { class Program { static void Main(string[] args) { Chilkat.Ssh ssh = new Chilkat.Ssh(); ssh.UnlockComponent(“Test”); // Hostname may […]

Aborting in C++

The technique for aborting any time-consuming Chilkat C++ method call follows this recipe: Declare your own class that derives from the appropriate Chilkat progress monitoring class.  For CkMailMan it is CkMailManProgress (as shown below).  For other Chilkat classes it is CkHttpProgress, CkFtpProgress, CkImapProgress, CkZipProgress, etc. Create an implementation for the AbortCheck method.  This will override the default implementation from the […]

Socket SendString (C++) w/ TCHAR

Question: I need to send a unicode string (e.g TCHAR *ptr) but the API only allows to send char. Answer: /* The _TCHAR data type is defined conditionally in Tchar.h. If the symbol _UNICODE is defined for your build, _TCHAR is defined as wchar_t; otherwise, for single-byte and MBCS builds, it is defined as char. */ bool sendString(CkSocket &sock, TCHAR […]

Is Calling .Dispose() Recommended for C# and VB.NET?

Question: In your examples online, we have noticed that .Dispose() is never called after using Chilkat classes (we are writing in C#). Is calling .Dispose() recommended?  Does your code not need to destroy any native resources or handles that would normally be cleaned up in the Dispose method (the IDisposeable interface) ? Answer: For objects that manage a TCP/IP socket […]

Chilkat C++ Libs – Link and Maintain Single EXE?

Question: I am developing a single EXE in C++ that doesn’t make use of any external libraries and including MFC. Can I add your zip libaries to my application and still maintain the application as a single EXE? Answer: Yes, the Chilkat C++ libs may be linked directly into your application.  This results in a single EXE containing the Chilkat library […]

HTTP Progress Monitoring in C++

This blog post shows how to monitor the progress of HTTP uploads and downloads in C++.  The first step is to create a C++ callback class that derives from the CkHttpProgress base class.  You’ll be overriding one or more of the callback methods.  For example: class MyHttpProgress : public CkHttpProgress { public: MyHttpProgress(void) { } virtual ~MyHttpProgress(void) { } void […]

Scan/Replace Text in Email Body in C++

This example may help C++ programmers needing to scan email bodies for strings and automatically replace: void EmailBodyExample(void) { CkEmail email; // Set the plain-text and HTML alternative bodies. // Note: Because we’re using literal strings, the strings passed // to these methods are ANSI strings (i.e. they are 1-byte per char // in this case). email.AddPlainTextAlternativeBody(“á, é, í, ó, […]

SFTP Progress Monitoring and Abort (C#)

Here is an example for monitoring the progress of an SFTP file transfer: void sftp_OnPercentDone(object sender, Chilkat.PercentDoneEventArgs args) { progressBar1.Value = args.PercentDone; // To abort at any point, you may set args.Abort = true // args.Abort = true; } void sftp_OnAbortCheck(object sender, Chilkat.AbortCheckEventArgs args) { // See https://cknotes.com/?p=149 for more information about // using the AbortCheck event… } private void […]

C++ String Compression: PPMD, Deflate, BZip2, LZW

This C++ example demonstrates string compression using four different compression algorithms: PPMD, Deflate, BZip2, and LZW. void TestCompression(const char *algorithm) { CkCompression comp; comp.put_Algorithm(algorithm); printf (“algorithm: %s\n”,algorithm); CkByteData compressedData; comp.CompressString(“abc abc abc abc abc abc abc abc abc abc abc 123 123 abc 123”,compressedData); // Get the compressed data: const unsigned char *pCompressedData = compressedData.getBytes(); unsigned long numBytes = compressedData.getSize(); […]