Skip to content

inputoutputlib

Print and NPrint write to the current output channel, Edit$, Edit and Inkey$ read from the current input channel. At the start they are the program’s standard input and output, normally the shell window the program was started from. Other libraries switch them: WindowOutput and WindowInput to a window, FileOutput and FileInput to a file. DefaultOutput and DefaultInput switch back to the shell window.

Each switch remembers the channel before it, so PopOutput and PopInput return to the previous channel, for example after writing a file:

If WriteFile(0,"RAM:log")
  FileOutput 0
  NPrint "done"
  PopOutput
  CloseFile 0
EndIf

The default input reads whole lines only: Inkey$ from it is the runtime error “Can’t Input Character from Default Input”.

Based on the inputoutputlib guide by Acid Software.

Library number 164.

Commands

DefaultInput

Makes the following Edit$ and Edit read from the shell window the program was started from, as at the start of the program.

Statement. No help text.
No arguments.

DefaultOutput

Sends the output of the following Print and NPrint commands to the shell window the program was started from, as at the start of the program.

Statement. No help text.
No arguments.

PopInput

Returns to the input channel that was current before the last switch, for example after FileInput or WindowInput.

Statement. No help text.
No arguments.

With runtime error checking, popping when nothing is left to pop, also at the start of the program before any switch, is the error “No Input channel to pop!”; without it, such a pop leaves the program without an input channel. The channels are remembered in a ring of 16 entries; only runtime error checking notices popping too often, without it old entries are returned (#194).

PopOutput

Returns to the output channel that was current before the last switch, for example after FileOutput or WindowOutput.

Statement. No help text.
No arguments.

With runtime error checking, popping when nothing is left to pop, also at the start of the program before any switch, is the error “No Output channel to pop!”; without it, such a pop leaves the program without an output channel. As with PopInput, only runtime error checking notices popping too often; without it old entries are returned (#194).