Base64到二进制(Delphi) [英] Base64 to Binary (Delphi)

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

问题描述

我用二进制来,你回答的Base64功能:
二进制Base64 (德尔福)

I used Binary to Base64 function that you answered : Binary to Base64 (Delphi)

我一个文件成功编码为Base64字符串,并将其写入MsSQL2008数据库,但我要问一个问题:
如何我可以用EncdDecd.pas再次将此文件写入到磁盘?

I successfully encode a file to base64 string and write it to MsSQL2008 database, but i want to ask a question: How can i write this file to disk again with using EncdDecd.pas?

推荐答案

像往常一样,大卫充分回答。虽然我不能抵抗,得到使用一些从最近的Delphi版本的东西的略微不同的解决方案。

As always, David answered sufficiently. Although I can't resist to give a slightly different solution using some of the goodies from the recent Delphi versions.

procedure DecodeFile(const base64: AnsiString; const FileName: string);
var
  stream: TBytesStream;
begin
  stream := TBytesStream.Create(DecodeBase64(base64));
  try
    stream.SaveToFile(Filename);
  finally
    stream.Free;
  end;
end;

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

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