Einzelnen Beitrag anzeigen

brechi

Registriert seit: 30. Jan 2004
823 Beiträge
 
#9

AW: $0 in stream and loading as text

  Alt 25. Aug 2014, 13:31
You have to write your own component to visualize the text.
Internal PAnsiChar/PWideChar is used and a #0 is the end of the text.

So if you use

Code:
  Memo1.Lines.Text := 'test1'#0'test2'#0;
only the "test1" will be shown.

If you dont want to save your data, then you can load the file into a TMemoryStream (or a string) and replace the #0 with another character.


Code:
var
  s: String;
  fm: TFileStream;
fm := TFileStream.Create;
fm.LoadFromFile('sadasd', fmOpenRead);
setLength(s, fm,size);
fm.Read(s[1], Length(s));
s := StringReplacte(s, #0, #1, [rfReplaceAll]);
memo1.lines.text := s;
etc.
  Mit Zitat antworten Zitat