Parameter | Description |
---|---|
pBinaryData | The address of the binary data |
iBinaryLen | The length of the binary data |
The data is encoded by calling Base64Encode and returned as a Variant string
Function Base64EncodeToVariantStr Pointer pBinaryData Integer iBinaryLen Returns Variant
Call: | Get Base64EncodeToVariantStr pBinaryData iBinaryLen to VariantVariable |
Base64EncodeToVariantStr creates a base 64 encoded Variant String from a binary memory buffer.
Base64EncodeToStr creates a base 64 encoded DataFlex String from a binary memory buffer.
Base64Encode converts binary data to base64 data.
You are responsible for eventually disposing of the newly created memory buffer.
This is often paired with Base64DecodeFromVariantStr.
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 | Base64DecodeFromVariantStr | Base64Encode | Base64Decode Free()