Posted by RussCAp12602 on May 10, 2008
I am trying to write the text from a RichEdit.Lines.GetText to a TFileStream. It works, but the result is a file full of gibberish.Here's sort of what I have:
var TS: TFileStream; Tx: String; i: Integer; begin TS := TFileStream.Create('text.txt', fmCreate); Tx := reEdit.Lines.GetText; i := Length(Tx); TS.Write(Tx, i); TS.Free; end;
The proper number of bytes (i) are written to the file. However, the actual data written is pure garbage that bears no similarity to the contents of Tx that I can determine.
What am I doing incorrectly?
Related articles
Follow Ups