'Welcome to the Commodore Computer Wiki!'

CMD (command)

Keyword Token Version Category(s)
CMD $9D 1.0 Command and Statement

Syntax

CMD file_number [ , [ , | ; | SPC(count) | TAB(column) ]… value [< , | ; | SPC(count) | TAB(column) > [value] ]… ]

Where:

  • file_number is a user-defined number (1 to 255) of an open file
  • value is a literal, variable, or an expression of either numeric or string type
  • count and column are a numberic literal, variable, or expression

Purpose

Redirect screen text output to a logical file, and optionaly print one or more values.

Notes

Redirection lasts until an error occurs, or a device input/operation (such as PRINT#) is used. The optional value argument(s) are sent to the device, exactly like PRINT#, but redirection remains in effect afterwards.

Example

OPEN 4,4
CMD 4, "MY PROGRAM LISTING"
LIST
PRINT#4
CLOSE 4

This example will LIST the BASIC program in memory on a printer (with a title line “MY PROGRAM LISTING”). The program listing (and the subsequent READY message) will be printed on paper and will not appear on screen. Failure to issue PRINT# before CLOSE will cause most printers to suppress the final line (they generally buffer data and do not actually print until a CR is received).

See also OPEN, PRINT#, USING


This page is a member of Commodore BASIC