OPEN (File I/O) Statement Programming Examples These example program lines show different uses of the OPEN (File I/O) statement. ----- Note ----- Do not run these examples without the specified files and devices. ---------------- The following statement opens MAILING.DAT as file number 1 and allows data to be added without destroying what is already in MAILING.DAT: OPEN "MAILING.DAT" FOR APPEND AS #1 If you wrote and installed a device driver named ROBOT, then the OPEN statement might appear as OPEN "\DEV\ROBOT" FOR OUTPUT AS #1 To open the printer for output, you could use either of the following two lines. (The first line uses the BASIC device LPT1: while the second line uses the DOS device LPT1.) OPEN "LPT1:" FOR OUTPUT AS #1 OPEN "LPT1" FOR OUTPUT AS #1 The following statement opens the file RECORDS in random-access mode, for reading only. The statement locks the file for writing, but allows reading by other processes while the OPEN is in effect. OPEN "RECORDS" FOR RANDOM ACCESS READ LOCK WRITE AS #1 The following example opens the file named INVEN for input as file number 2: OPEN "I",2,"INVEN"