Click or drag to resize

EncodeBase64 Function

X#
Encode a file for e-mail transfer.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION EncodeBase64(
	hSource AS IntPtr,
	hDestination AS IntPtr
) AS LONG
Request Example View Source

Parameters

hSource
Type: IntPtr
Handle of the file to encode.
hDestination
Type: IntPtr
Handle of the file to which the encoded text is to be written.

Return Value

Type: Long
The number of bytes that were encoded.
Remarks
Base64 encoding is used to transmit files attached to messages over the Internet.
Examples
X#
 1hOut := FCreate("C:\MyFiles\MailOut.txt")
 2IF hfOut != F_ERROR
 3    hIn := FOpen("C:\MyFiles\Source.txt", FO_READ)
 4    IF hIn != F_ERROR
 5        nTotalBytes := EncodeBase64(hIn, hOut)
 6        TextBox{,"Encode", "Bytes Encoded: " + ;
 7            AsString(nTotalBytes)}:Show()
 8ENDIF
 9ENDIF
10FClose(hfOut)
11FClose(hf)
For a more complete example of EncodeBase64(), see the Mime Encoding sample application (CAVOxx\SAMPLES\INTERNET\MIME\MENCODE.AEF).
See Also