Re: Displaying the contents of a text file

Richard Russell

On Thu, May 11, 2017 at 02:44 pm, Ian_Wade_G3NRW wrote:
I am trying to display the contents of a 600-line plain text file in
BB4W, in an editbox.

If you have a 'plain text file' (and I am assuming you mean a file that uses CRLF pairs as the line terminations) it is quite unnecessary to split it into its constituent lines before sending it to the edit control.  It is simpler and quicker to keep it as a single 'unit':

      file% = OPENIN("file.txt")
      text$ = GET$#file% BY EXT#file%
      CLOSE #file%
      SYS "SetDlgItemText", !dlg%, 100, text$

It would only be necessary to split it into individual lines if you needed to change the line terminations from (say) LF to  CRLF, i.e. it was a Linux-style text file.

The style bit for read-only is ES_READONLY


Join to automatically receive all group messages.