Binary to Base64 (Delphi)

前端 未结 2 711
一个人的身影
一个人的身影 2020-11-27 19:20

how can i get content of an exe file and convert it into Base64 encoding ?

Edit

I use D2010 and i wan

相关标签:
2条回答
  • 2020-11-27 20:01

    In Delphi 2009/2010/XE there is unit EncdDecd.pas (Soap.EncdDecd.pas for Delphi XE2) containing the functions EncodeBase64 and DecodeBase64. You can load the exe file into a memorystream and then call EncodeBase64.

    function EncodeFile(const FileName: string): AnsiString;
    var
      stream: TMemoryStream;
    begin
      stream := TMemoryStream.Create;
      try
        stream.LoadFromFile(Filename);
        result := EncodeBase64(stream.Memory, stream.Size);
      finally
        stream.Free;
      end;
    end;
    
    0 讨论(0)
  • 2020-11-27 20:24

    In ancient Delphi versions, you can use synapse (link here)

    Just put synacode.pas in your uses e call EncodeBase64/EncodeBase64.

    Cheers

    0 讨论(0)
提交回复
热议问题