qb45advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
.eofx
:nEOF Function Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
EOF Function Programming Example
 
This example reads single-precision values from the file DATA.IN into an
array M using a DO LOOP. The loop uses the EOF function to signal the
end of the file. A second DO LOOP displays the contents of M to confirm
that it contains the values from DATA.IN.
 
This example will not run without a DATA.IN data input file.
 
DIM M(0 TO 2000)
 
OPEN "DATA.IN" FOR INPUT AS 1
C = 0
DO WHILE NOT EOF(1) AND C <= 2000
      INPUT #1, M(C)
      C = C + 1
LOOP
 
CLS    ' Clear screen
D = 0
DO WHILE D < C
      PRINT M(D)
      D = D + 1
LOOP
 
  Tip: Run the example with a simple DATA.IN data file you create
       with a text editor. For example, create a one-line DATA.IN file with
       the following sequence of numbers:
 
       10 20 30 40 50 60 70 80 90
 
       Then run the example program to produce the following sample output.
 
Sample Output
 
10
20
30
40
50
60
70
80
90