(Tcl) Workaround for the deprecated Crypt2.Encode method
Shows how to replace the deprecated Encode method. (Chilkat is moving away from the use of CkByteData.) Note: This example requires Chilkat v11.0.0 or greater.
load ./chilkat.dll
set crypt [new_CkCrypt2]
set path "c:/someDir/example.dat"
# Such as base64, hex, hex_lower, etc.
set encoding "base64"
# ------------------------------------------------------------------------
# The Encode method is deprecated:
set inData [new_CkByteData]
CkByteData_loadFile $inData $path
set encodedBytes [CkCrypt2_encode $crypt $inData $encoding]
# ------------------------------------------------------------------------
# Workaround.
# (Chilkat is moving away from using CkByteData)
set bd [new_CkBinData]
CkBinData_LoadFile $bd $path
set encodedBytes [CkBinData_getEncoded $bd $encoding]
delete_CkCrypt2 $crypt
delete_CkByteData $inData
delete_CkBinData $bd
|