| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Encodes a character string base 64.
HB_Base64Encode( <cString>, <nBytes> ) --> cBase64
The function returns a base 64 encoded character string.
HB_Base64Encode() uses the Base 64 algorithm for encoding a character string. The encoded string is about one third larger than the original string, but contains only alphanumeric characters.
Pass the resulting string to function HB_Base64Decode() to obtain the original data.
| See also: | HB_Base64Decode(), HB_Base64DecodeFile(), HB_Base64EncodeFile() |
| Category: | Encoding/Decoding , xHarbour extensions |
| Source: | tip\encoding\Base64.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example outlines base 64 encoding and decoding.
PROCEDURE Main
LOCAL cString := "xHarbour"
LOCAL cBase64 := HB_Base64Encode( cString, Len(cString ) )
? cBase64 // result: eEhhcmJvdXI==
? HB_Base64Decode( cBase64 ) // result: xHarbour
RETURN
http://www.xHarbour.com