DataFlex
DataFlex
UU Encoding and Decoding
See more Encryption Examples
Demonstrates how to UU encode and decode.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoCrypt
String sS1
String sS2
String sS3
2 Handle hoCrypt2
String sTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt
If (Not(IsComObjectCreated(hoCrypt))) Begin
Send CreateComObject of hoCrypt
End
Move "This string is to be UU encoded" To sS1
Set ComUuMode Of hoCrypt To "666"
Set ComUuFilename Of hoCrypt To "something.txt"
// UU encode:
Get ComEncodeString Of hoCrypt sS1 "ansi" "uu" To sS2
// Note: Call crypt.Encode instead of crypt.EncodeString
// to UU encode binary bytes (i.e. non-text binary data).
Showln sS2
// UU decode:
Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt2
If (Not(IsComObjectCreated(hoCrypt2))) Begin
Send CreateComObject of hoCrypt2
End
Get ComDecodeString Of hoCrypt2 sS2 "ansi" "uu" To sS3
// Note: Likewise, call crypt.Decode to decode non-text binary data.
Showln sS3
// Show the file permissions mode and filename found
// in the UU encoded data:
Get ComUuMode Of hoCrypt2 To sTemp1
Showln "UuMode = " sTemp1
Get ComUuFilename Of hoCrypt2 To sTemp1
Showln "UuFilename = " sTemp1
End_Procedure