Sample code for 30+ languages & platforms
PowerBuilder

Get Contents of File as Base64

See more Encryption Examples

Demonstrates how to read the contents of a file and convert to a base64 string.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Bd

li_Success = 0

loo_Bd = create oleobject
li_rc = loo_Bd.ConnectToNewObject("Chilkat.BinData")
if li_rc < 0 then
    destroy loo_Bd
    MessageBox("Error","Connecting to COM object failed")
    return
end if

li_Success = loo_Bd.LoadFile("qa_data/jpg/starfish.jpg")
if li_Success = 0 then
    Write-Debug "Failed to load file."
    destroy loo_Bd
    return
end if

Write-Debug loo_Bd.GetEncoded("base64")

// If you want mult-line base64:
Write-Debug "--"
Write-Debug loo_Bd.GetEncoded("base64_mime")

// If you want hex..
Write-Debug "--"
Write-Debug loo_Bd.GetEncoded("hex")

// etc.


destroy loo_Bd