OPEN

Link titleSyntax

OPEN filename

(OPEN filename mode)

Explanation

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.

Because a colon is a delimiter, it must be preceded with \ to be read correctly by Logo. See also CLOSE and CREATE.

Legal MS-DOS device name include: 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: 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.

The commands .READ, .WRITE and .SEEK are available for low level I/O.

Examples

? OPEN "PRN\:

Result: 1

?

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.

TO LOADIT


 * MAKE "STANDARD.OUTPUT OPEN "NUL\:


 * MAKE "LOADED? LOAD "PICS.LGO


 * MAKE "STANDARD.OUTPUT 0

END

? LOAD "PICS.LGO

Loading File: PICS.LGO

CIRCLE is defined.

SQUARE is defined.

TRIANGLE is defined.

? LOADIT

PICS.LGO

?