Physical Devices

I/O statements that do not refer to a specific file or I/O device read from standard input and write to standard output. Standard input is the keyboard, and standard output is the screen (console). To perform input and output on a physical device other than the keyboard or screen, you specify the device name as the filename to be read from or written to.

Some physical device names are determined by the host operating system; others are recognized by Visual Fortran. Extensions on most device names are ignored.

Filenames for Device I/O

Device Description
CON Console (standard output)
PRN Printer
COM1 Serial port #1
COM2 Serial port #2
COM3 Serial port #3
COM4 Serial port #4
LPT1 Parallel Port #1
LPT2 Parallel Port #2
LPT3 Parallel Port #3
LPT4 Parallel Port #4
NUL NULL device. Discards all output; contains no input
AUX Serial port #1
LINE 1 Serial port #1
USER 1 Standard output
ERR 1 Standard error
CONOUT$ Standard output
CONIN$ Standard input

1 If you use one of these names with an extension—for example, LINE.TXT—Fortran will write to a file rather than to the device.

Examples of opening physical devices as units are:

   OPEN (UNIT = 4, FILE = 'PRN')
   OPEN (UNIT = 7, FILE = 'LPT2', ERR = 100)