Converting TMemoryStream to 'String' in Delphi 2009

后端 未结 7 986
南方客
南方客 2020-11-28 05:52

We had the following code prior to Delphi 2009:

function MemoryStreamToString(M : TMemoryStream): String;
var
    NewCapacity: Longint;
begin
    if (M.Size          


        
7条回答
  •  孤街浪徒
    2020-11-28 06:23

    Or perhaps you can refactor your code to use directly a TStringStream directly? You can use it instead of TMemoryStream (they have the same interface) and you can 'convert' it to a string by simply calling myString := myStringStream.DataString;

提交回复
热议问题