Tcl
Tcl
Get Contents of File as Base64
See more Encryption Examples
Demonstrates how to read the contents of a file and convert to a base64 string.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
set bd [new_CkBinData]
set success [CkBinData_LoadFile $bd "qa_data/jpg/starfish.jpg"]
if {$success == 0} then {
puts "Failed to load file."
delete_CkBinData $bd
exit
}
puts [CkBinData_getEncoded $bd base64]
# If you want mult-line base64:
puts "--"
puts [CkBinData_getEncoded $bd base64_mime]
# If you want hex..
puts "--"
puts [CkBinData_getEncoded $bd hex]
# etc.
delete_CkBinData $bd