Reader's Clinic - Changing from LPT1 to LPT2 in RBASIC

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 JUL 19901.15+EXPERTSETPTR, LPT1, LPT2

Both Patrick Collins of Softsolve Computer Systems and Jonathan Bird of Argyle Fabrics asked the same question recently - "How can one change from LPT1 to LPT2 from within RBASIC?".

The solution to this is straightforward, and covered already (albeit indirectly) in REVMEDIA 6:4. RevTech also referred me back to SETPTR.

As previously documented, the SETPTR routine redirects printer i/o to a nominated file. To DOS, LPT1 and LPT2 are reserved filenames and to all intents and purposes can be treated as files. Thus to change to LPT2 simply

 CALL SETPTR("LPT2" : CHAR(0),1)

and to change back to LPT1,

 CALL SETPTR("LPT1" : CHAR(0),1)

(Volume 2, Issue 3, Page 3)