二进制为Base64(德尔福) [英] Binary to Base64 (Delphi)

查看:203
本文介绍了二进制为Base64(德尔福)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么可以得到一个 exe文件文件的内容,并将其转换成的Base64 编码?

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

修改

我用 D2010 ,我想知道怎么可能是什么呢?

I use D2010 and i want to know how is it possible exactly ?


  • 打开一个exe文件

  • 它的内容转换成的base64

  • open an exe file
  • convert its content into base64

推荐答案

在的Delphi 2009/2010 / XE有单位 EncdDecd.pas 包含功能Soap.EncdDecd.pas 德尔福XE2)恩codeBase64 德codeBase64 。您可以将EXE文件加载到一个MemoryStream,然后调用恩codeBase64。

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;

这篇关于二进制为Base64(德尔福)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆