1.09 Input and Output

Overview

All input and output in LynPlex is carried out using logical files. These files may be assigned explicitly or implicitly.

A logical file is associated at open time with a physical file. A physical file may be a file on disk, a physical device or a logical device such as a console or a window.

Stream input and output

Stream input and output in LynPlex is carried out using the get and put commands. By default the get command reads from stdin (or sysin on some systems) and the put command writes to stdout (or sysout). See 3.02 Stream Output for details.

Much of the time stdin and stdout will be assigned to a computer console. It is equally possible, however, to find either of them (or stderr/syserr) redirected to a file or piped to or from another program. This should not make any difference to the program as they will all be streams of data, and the program should be unaware of how this is handled externally. An example of this is when LynPlex is used as a CGI processor and stdin and stdout are handled by the Web Server. See 11.01 Brief Introduction to CGI for more details.

LynPlex Files

A LynPlex file appears to the user as another form of variable. Initially it will be set up as a string variable containing only the external file name. At open time this variable will be converted to a file control block. This is transparent to the user.

See 3.01 File Handling for details.

It is also possible to load and save whole files using the load and save commands. These commands are described in more detail in 3.07 File Input and Output.

Consoles

A console in LynPlex can be considered a separate device that just happens to handle standard input and output. It can also used for displaying error messages and for tracing program execution. For this reason stderr (syserr) is normally directed there as well.

There are occasions when you may want to access the console as a windowed or full-screen device. In this case although it may be possible to use stdin and stdout, it is preferable to use a dedicated console. This is done using the console command and options on the get and put commands. See 3.05 Consoles for more details.

If required standard input and output can be redirected to a second console window and that way kept separate from error messages and trace information. This is the way LynPlex works when running interactively. See 8.01 Interactive Mode for more details.

Devices

In addition there may be components supporting other devices either as standard or as an extension to the language. Normally other devices will still use get and put, but there may also be specialised commands for those devices. See 3.01 File Handling for details.

Graphics Windows

In this context graphic windows are considered as a separate devices with their own support component.


lynplex/lp0109.txt · Last modified: 2012/09/08 11:47 (external edit)