Xceed Binary Encoding Library Documentation
Examples / Encoding from file to memory (Delphi example)
In This Topic
    Encoding from file to memory (Delphi example)
    In This Topic

    This sample encodes with the Base64 format from file to memory

    Delphi Copy Code

    uses XceedBinaryEncodingLib_TLB; 

    var
      xBinEncode : TXceedBinaryEncoding; 
      xBase64Format : XceedBase64EncodingFormat; 
      vaBytesRead : OleVariant; 
      vaEncoded : OleVariant; 
    begin
      xBinEncode := TXceedBinaryEncoding.Create( self ); 
      xBinEncode.License( 'your license key' ); 

      xBase64Format := CoXceedBase64EncodingFormat.Create();  

      xBinEncode.EncodingFormat := xBase64Format;

      try 
        vaEncoded := xBinEncode.ReadFile( 'c:\temp\source.txt', 0, 0, bfpEncode, true, 
                                          vaBytesRead );  

        ShowMessage( 'Encoding successful!' ); 
      except 
        on xErr : Exception do 
          ShowMessage( xErr.Message ); 
      end; 

      xBinEncode.Free(); 
    end;