(OPEN filename mode)
OPEN prepares for input or output the DOS file or device specified by its input, and then outputs its assigned Logo stream number. Data may then be read using READ, READCHAR, READLINE, READLIST, READQUOTE and other Logo primitives by making STANDARD.INPUT the stream number. If the specified file or device does not exist, OPEN outputs FALSE.
Legal MS-DOS device name include:
|CON\:||Keyboard and screen|
|AUX\: or COM1\:||First asynchronous communications adapter|
|COM2\:||Second asynchronous communciations adapter|
|LPT1\: or PRN\:||First parallel printer|
|LPT2\:||Second parallel printer|
|LPT3\:||Third parallel printer|
OPEN may optional be supplied with a third input which describes the open mode. This is a string consisting of one or more characters. The flowing modes are supported:
|"R||The file is opened for reading only. If the file does not exist, an error is generated.|
|"W||The file is opened for writing only. If the file does not exist, it is created. Any data in the file is overwritten.|
|"RW||The file is opened for both reading and writing. If the file does not exist, it is created.|
|"A||The file is opened for writing only. If the file does not exist, it is created. The data written is appended to the end of the file|
Optionally, this string may be followed by the letter "B which marks the file as binary. Normally, reading stops at the end of a line feed character, and line feed characters written are translated into CR/LF character pairs. If the file is opened in binary mode all data is transferred untranslated.
? OPEN "PRN\:
The following procedure prevents procedure names from displaying on the screen when Logo loads the file PICTURES. Instead, it redirects the Logo output stream to a null device.
- MAKE "STANDARD.OUTPUT OPEN "NUL\:
- MAKE "LOADED? LOAD "PICS.LGO
- MAKE "STANDARD.OUTPUT 0
? LOAD "PICS.LGO
Loading File: PICS.LGO
CIRCLE is defined.
SQUARE is defined.
TRIANGLE is defined.