statement/OPEN statement/OPEN NAME OPEN -- Opens a logical file for I/O operations ABBREVIATION o <shift> P SYNOPSIS OPEN <file>[,<device>[,<address>[,"<command>,<type>,<mode>"]]] FUNCTION The OPEN statement allows your computer to access devices such as the tape and disk for data, a printer, or even the screen. The word OPEN is followed by a logical file number (<file>), which is the number to which all other BASIC statements will refer. This number is from 1 to 255. There is normally a second number after the first called the device number (<device>). Device number 0 is the keyboard, 1 is the tape (default), 3 is the screen, 4 is the printer, 8 is usually the disk. A zero (0) may be included in front of the device number digit (e.g. 08 for 8). Following the second number may be a third number called the secondary address (<address>). In the case of the tape, this can be 0 for read, 1 for write, and 2 for write with end-of-tape marker at the end. In the case of the disk, the number refers to the channel number. In the printer, the secondary addresses are used to set the mode of the printer. There may also be a string following the third number, which could be a command to the disk drive or name of the file on tape or disk (<command>). The type (<type>) and mode (<mode>) refer to disk files only. (File types are prg, seq, rel, and usr; modes are read and write.) INPUTS <file> - logical file number for the file to be opened (1-255) <device> - input/output device number <address> - secondary address for device <command> - command for device <type> - file type (prg/seq/rel/usr) <mode> - I/O mode (read/write) RESULT Opens a logical file for I/O operations. EXAMPLES 10 OPEN 3,3 OPENs the screen as a device. 10 OPEN 1,0 OPENs the keyboard as a device. 10 OPEN 1,1,0,"UP" OPENs the tape for reading, file to be searched for is named UP. OPEN 4,4 OPENs a channel to use the printer. OPEN 15,8,15 OPENs the command channel on the disk. 5 OPEN 8,8,12,"TESTFILE,SEQ,WRITE" Creates a sequential disk file for writing. NOTES None BUGS None SEE ALSO CLOSE CMD GET# INPUT# PRINT#