(Tcl) UU Encoding and Decoding
Demonstrates how to UU encode and decode.
load ./chilkat.dll
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set crypt [new_CkCrypt2]
set s1 "This string is to be UU encoded"
CkCrypt2_put_UuMode $crypt "666"
CkCrypt2_put_UuFilename $crypt "something.txt"
# UU encode:
set s2 [CkCrypt2_encodeString $crypt $s1 "ansi" "uu"]
# Note: Call crypt.Encode instead of crypt.EncodeString
# to UU encode binary bytes (i.e. non-text binary data).
puts "$s2"
# UU decode:
set crypt2 [new_CkCrypt2]
set s3 [CkCrypt2_decodeString $crypt2 $s2 "ansi" "uu"]
# Note: Likewise, call crypt.Decode to decode non-text binary data.
puts "$s3"
# Show the file permissions mode and filename found
# in the UU encoded data:
puts "UuMode = [CkCrypt2_uuMode $crypt2]"
puts "UuFilename = [CkCrypt2_uuFilename $crypt2]"
delete_CkCrypt2 $crypt
delete_CkCrypt2 $crypt2
|