Parameter | Description |
---|---|
vBase64Str | Variant String as Base64 |
iBinaryLen (ByRef) | Returns the length of the binary buffer |
The buffer address of the decoded string
Function Base64DecodeFromVariantStr Variant vBase64Str Integer ByRef iBinaryLen Returns Pointer
Call: | Get Base64DecodeFromVariantStr vBase64Str (&iBinaryLen) to PointerVariable |
Base64DecodeFromVariantStr decodes a base 64 encoded Variant String and places it in a newly created memory buffer.
You are responsible for eventually disposing of the newly created memory buffer.
This is often paired with Base64EncodeToVariantStr.
See discussion in the cCharTranslate class overview about the advantages and disadvantage of using the Variant String type.
Use Windows.pkg Use cCharTranslate.pkg Object oCharTranslate is a cCharTranslate End_Object Procedure TestBase64EncodeVariantStr Pointer aBinary aBinary2 Integer iVoid iLen iLen2 Variant vVar String sData sData2 // aBinary could be any binary data of length iLen. Move "Pretend this is actually binary data" to sData Move (AddressOf(sData)) to aBinary Move (SizeOfString(sData)) to iLen // base64Encode to variant Get Base64EncodeToVariantStr of oCharTranslate aBinary iLen to vVar // Base64 decode from variant Get Base64DecodeFromVariantStr of oCharTranslate vVar (&iLen2) to aBinary2 If (iLen<>iLen2 or MemCompare(aBinary,aBinary2,iLen2)) Begin Send Info_Box "Test Failed" End Move (Free(aBinary2)) to iVoid End_Procedure Send TestBase64EncodeVariantStrSee Also
Base64EncodeToStr | Base64DecodeFromStr | Base64EncodeToVariantStr | Base64Encode | Base64Decode Free()