Delphi Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Byte Array
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
Bzip2
LZW
Bz2
Icon

Type Conversion

 

Article: Understanding COM References in Delphi

Unzip / Inflate a Text File into an In-Memory String

Download Chilkat Zip ActiveX

Demonstrates how to unzip a text file into an in-memory string.

// Shows how to open a zip and access the contents of a text
// file.
procedure TForm1.Button9Click(Sender: TObject);
var
  i : Integer;
  success : Integer;
  entry: IChilkatZipEntry2;
  fileContents: WideString;
  addCr: Integer;

begin
  ChilkatZip21.UnlockComponent('anything for 30-day trial');

  // Open a zip.
  success := ChilkatZip21.OpenZip('test.zip');
  if (success = 0) then
    begin
      ChilkatZip21.SaveLastError('zipErrorLog.txt');
      ShowMessage(ChilkatZip21.LastErrorText);
    end
  else
    begin
        Memo1.Lines.Clear();

        // Get the test.txt file.
        entry := ChilkatZip21.FirstMatchingEntry('*test.txt');

        // InflateToString3 returns a Unicode string.
        // If the text file within the zip contains text in a different
        // character encoding, we indicate it so the encoding conversion
        // takes place.  This allows for text files in any character encoding
        // to be retrieved as Unicode.
        fileContents := entry.InflateToString3('iso-8859-1');

        // InflateToString2 returns a Unicode string, assuming the text file
        // contained characters in the ANSI encoding.
        fileContents := entry.InflateToString2();

        // InflateToString returns a Unicode string, assuming the text file
        // contained characters in the ANSI encoding.   If addCr is set to 1,
        // line endings will be converted to CRLFs if necessary.
        addCr := 1;
        fileContents := entry.InflateToString(addCr);

        Memo1.Text := fileContents;
    end;

end;

 

 

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

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

Mail Component · .NET Email Component · XML Parser