Xbase++
Xbase++
UU Encoding and Decoding
See more Encryption Examples
Demonstrates how to UU encode and decode.Chilkat Xbase++ Downloads
LOCAL oCrypt
LOCAL cS1
LOCAL cS2
LOCAL cS3
LOCAL oCrypt2
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oCrypt := CreateObject("Chilkat.Crypt2")
cS1 := "This string is to be UU encoded"
oCrypt:UuMode := "666"
oCrypt:UuFilename := "something.txt"
// UU encode:
cS2 := oCrypt:EncodeString(cS1, "ansi", "uu")
// Note: Call crypt.Encode instead of crypt.EncodeString
// to UU encode binary bytes (i.e. non-text binary data).
? cS2
// UU decode:
oCrypt2 := CreateObject("Chilkat.Crypt2")
cS3 := oCrypt2:DecodeString(cS2, "ansi", "uu")
// Note: Likewise, call crypt.Decode to decode non-text binary data.
? cS3
// Show the file permissions mode and filename found
// in the UU encoded data:
? "UuMode = " + oCrypt2:UuMode
? "UuFilename = " + oCrypt2:UuFilename
oCrypt:destroy()
oCrypt2:destroy()