Login
Plus/4 EncyclopediaFirstBackNextLast

CMD Statement
Category
Reference/Commodore Basic V3.5

Topic
CMD file# [,string]

CMD sends the output which would normally go to the screen (from commands such as PRINT, LIST, but not POKEs into the screen) to another device, such as a printer, or a data file on tape or disk. The device or file must be opened first with the OPEN statement, otherwise ?FILE NOT OPEN ERROR occurs.

The CMD statement must be followed by a file number, or a numeric variable containing the file number. This may be followed by a string or a string variable, the contents of which will be sent immediately to the target device.

Examples
OPEN 1,4 Opens device 4 (printer)
CMD 1,"THIS IS MY PROGRAM" All screen output now goes to the printer, and the text "THIS IS MY PROGRAM" is printed
LIST The listing goes to the printer, including the READY prompt at the end
PRINT#1 Output returns to the screen
CLOSE 1 Closes the file

Abbreviation
C SHIFT+M



Copyright © Plus/4 World Team, 2001-2024