Reads one or more bytes from a previously opened file.
i = Inp(#n)
i = Inp|(#n)
i = Inp&(#n)
i = Inp%(#n)
n: integer expression; channel number
Inp(#n) or Inp|() reads a byte from a previously opened file. The numerical expression n contains the channel number (from 0 to 511), with which the file is being accessed.
Inp&(#n) reads 2 bytes (16-bit integer) from a previously opened file.
Inp%(#n) reads 4 bytes (32-bit integer) from a previously opened file.
OpenW 1
Local i%, a&, b%
Open App.Path & "\TEST.DAT" for Output As # 1
For i% = 1 To 50
Print # 1, Str$(i%, 3)
Next
Close # 1
Open App.Path & "\TEST.DAT" for Input As # 1
For i% = 1 To 20
a& = Inp|(# 1) ' or Inp()
Print a&, Chr(a&)
Next i%
Close # 1
Kill App.Path & "\TEST.DAT" // Tidy-up line
opens the file TEST.DAT on drive C and reads in a For...Next loop one byte from this file 20 times and prints the values to the screen.
Inp|(# ) is synonym with Inp(# ) and can be used instead.
{Created by Sjouke Hamstra; Last updated: 10/10/2014 by James Gaite}