VCL Delphi

Title: How to use TMemoryStream to save data
procedure StreamWriteStr(var ms: TMemoryStream; s: string);
begin
ms.Write(s[1], Length(s));
end;
procedure StreamWriteLnStr(var ms: TMemoryStream; s: string);
begin
StreamWriteStr(ms, s + #13#10);
end;
Or you could create you own descendant class of TMemoryStream with a method
to write strings.