Insert a file into the default position of a TMemo  

Send By: Q3 Team
Web : http://www.q3.nu
Email: dlib@q3.nu
Date: 18/12/99

Tip accessed 522 times

 


Using a TMemoryStream to read the file, then use the TMemo's SetSelTextBuf method to insert the *itext;

An Example:



            var
              TheMStream : TMemoryStream;
            begin
              TheMStream := TMemoryStream.Create;
              TheMStream.LoadFromFile('C:\AUTOEXEC.BAT');
              TheMStream.Seek(0, soFromEnd);
              {Null terminate the buffer}
              {Terminamos el buffer con null}
              TheMStream.Write(#0, 1);
              TheMStream.Seek(0, soFromBeginning);
              Memo1.SetSelTextBuf(TheMStream.Memory);
              TheMStream.Free;
            end;