#1 2018-03-23 12:50:09

DigDiver
Member
Registered: 2013-04-29
Posts: 137

TTextWriter.Text new behavior?

Hi, in the new version after the TTextWriter.Text is executed and then new data is added, the old data will be broken. Is it normal?

 Writer := TTextWriter.CreateOwnedStream();

 Writer.AddString('One-');
 Writer.AddString('Two-');
 Writer.AddString('Free-');

 Writer.FlushFinal;

 t1:= Writer.Text; // One-Two-Free-

 Writer.AddString('Ones more');

 Writer.FlushFinal;

 t2 := Writer.Text; // #0#0#0#0#0#0#0#0#0#0#0#0#0'Ones more'

Offline

#2 2018-03-23 13:26:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: TTextWriter.Text new behavior?

FlushFinal is supposed to be Final... if you reuse the TTextWriter, there is no behavior expected, and it changed to introduce direct content reformating.

Offline

Board footer

Powered by FluxBB