PureBasic
PureBasic
Decode Base64
Demonstrates how to decode base64.Chilkat PureBasic Downloads
IncludeFile "CkBinData.pb"
Procedure ChilkatExample()
success.i = 0
bd.i = CkBinData::ckCreate()
If bd.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Append a base64 string to bd.
success = CkBinData::ckAppendEncoded(bd,"c2VjcmV0","base64")
; The bd now contains the decoded bytes.
; Let's say it was a password string..
password.s = CkBinData::ckGetString(bd,"utf-8")
; Decodes to "secret".
Debug "password = " + password
CkBinData::ckDispose(bd)
ProcedureReturn
EndProcedure