Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
DH Key Exchange
DKIM/DomainKeys
Digital Certificates
Digital Signatures
DSA
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

 

 

const char * -- utf-8 vs ANSI

Explains the "Utf8" property that is common to all Chilkat C++ classes.

Download Chilkat C/C++ Libraries for VC++ 9.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 9.0 / x64

Download Chilkat C/C++ Libraries for VC++ 8.0 / Win32

Download Chilkat C/C++ 64-bit Libraries for VC++ 8.0 / x64

Download Chilkat Visual Studio 2005 C/C++ Libs for Windows Mobile, Pocket PC, SmartPhone, WinCE

Download Chilkat C/C++ Libraries for VC++ 7.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0, Win 95/98/NT4 Compatible

#include <CkEmail.h>
#include <CkString.h>

void ChilkatSample(void)
    {
    //  All Chilkat C++ classes have a "Utf8" bool property (i.e. there
    //  is a get_Utf8() method, and a put_Utf8(bool newval) method.

    //  When a Chilkat method returns a "const char *", or if
    //  a method argument is a "const char *", it is by default
    //  an ANSI string.  However, if the Utf8 property is set to true,
    //  then "const char *" is a utf-8 string.  This means you may
    //  pass utf-8 strings to Chilkat methods, and Chilkat methods
    //  may return utf-8 strings.

    //  For example, here's how to get an email's Subject as
    //  either a utf-8 or ANSI string.
    CkEmail email;

    bool success;
    success = email.LoadEml("someEmail.eml");
    if (success != true) {
        printf("%s\n",email.lastErrorText());
        return;
    }

    const char * ansiStr;
    const char * utf8Str;

    //  By default, "const char *" is ANSI:
    ansiStr = email.subject();

    //  Set the Utf8 property = true to get the subject
    //  as a utf-8 string:
    email.put_Utf8(true);
    utf8Str = email.subject();

    //  When passing "const char *" to other Chilkat object,
    //  make sure the Utf8 properties agree.
    CkString strObj;

    //  The following line is incorrect, because by default a Chilkat object
    //  interprets "const char *" as ANSI characters, not utf-8:
    strObj.append(utf8Str);

    //  The correction is to set Utf8 = true
    strObj.put_Utf8(true);
    strObj.append(utf8Str);

    //  To get a wchar_t *, call CkString::getUnicode
    //  
wchar_t *wideStr = strObj.getUnicode();

    }

Need a specific example? Send a request to support@chilkatsoft.com

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

Mail Component · .NET Mail Component · XML Parser