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

    This sample encodes with the Base64 format from memory to a file

    Delphi Copy Code

    uses XceedBinaryEncodingLib_TLB 

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

      xBase64Format := CoXceedBase64EncodingFormat.Create();  

      xBinEncode.EncodingFormat := xBase64Format; 

      vaData := 'This is the text to encode'; 

      try 
        xBinEncode.WriteFile( vaData, bfpEncode, true, 'c:\temp\encoded.b64', false ); 
        ShowMessage( 'Encoding successful!' ); 
      except 
        on xErr : Exception do 
          ShowMessage( xErr.Message ); 
      end; 

      xBinEncode.Free(); 
    end;