OPENINOP.

A function which opens a file for reading and returns the handle of the file. This number must be used in subsequent references to the file with BGET#, INPUT#, EXT#, PTR#, EOF# or CLOSE#.

A returned value of zero signifies that the specified file was not found.

X=OPENIN "jim"
X=OPENIN A$
X=OPENIN (A$)
X=OPENIN ("FILE1")
X=OPENIN ("COM2")

The example below reads data from disk into an array. If the data file does not exist, an error message is printed and the program ends.

10 DIM posn(10),name$(10)
20 fnum=OPENIN "TOPTEN"
30 IF fnum=0 THEN PRINT "No TOPTEN data": END
40 FOR i=1 TO 10
50   INPUT#fnum,posn(i),name$(i)
60 NEXT
70 CLOSE#fnum

Syntax

<n-var>=OPENIN(<str>)

Associated Keywords