如何实现将二进制文件读入流中再保存为文本文件?(20分)

  • 主题发起人 主题发起人 1978
  • 开始时间 开始时间
用 ObjectBinaryToText() 函数即可!如:<br><br>var <br>&nbsp; ms: TMemoryStream; <br>&nbsp; fs: TFileStream; <br>begin &nbsp;<br>&nbsp; fs := TFileStream.Create(filename, fmOpenRead); <br>&nbsp; ms := TMemoryStream.Create; <br>&nbsp; try <br>&nbsp; &nbsp; ms.loadfromfile(sourcefilename); <br>&nbsp; &nbsp; ms.position := 0; <br>&nbsp; &nbsp; ObjectBinaryToText(ms, fs); &nbsp; //将二进制内容转换为文本<br>&nbsp; finally <br>&nbsp; &nbsp; ms.Free; <br>&nbsp; &nbsp; fs.free; <br>&nbsp; end; <br>end;
 
接受答案了.
 
后退
顶部