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.
OPEN (File I/O) Statement Programming Examples
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
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 "DEVROBOT" 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"