Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utai.UUCP Path: utzoo!utcsrgv!utai!hunterj From: hunterj@utai.UUCP (James Hunter) Newsgroups: net.micro.cpm Subject: Re: Turbo Pascal output Message-ID: <348@utai.UUCP> Date: Thu, 24-Jan-85 19:01:50 EST Article-I.D.: utai.348 Posted: Thu Jan 24 19:01:50 1985 Date-Received: Thu, 24-Jan-85 20:01:26 EST References: <1230@trwrba.UUCP> <864@ihuxk.UUCP> Reply-To: hunterj@utai.UUCP (James Hunter) Organization: CSRI, University of Toronto Lines: 42 Summary: In article <864@ihuxk.UUCP> db21@ihuxk.UUCP (Dave Beyerl) writes: > >> Subject: Turbo Pascal output >> >> Is there a method that enables program output to be sent >> to the screen and printer??? Cntrl-P works when running >> CPM, but from Turbo Pascal, it doesn't. (at least not on >> my machine.) Do I make the program a .COM file and use Cntrl-P?? >> Thanks in advance for any help given. >> > In order to print output to both the screen and the line >printer in Turbo Pascal under CP/M you must include a second >writeln statement which directs its output to the Lst device. >For example, to print the string 'Hello There!' on both the >screen and printer, you would include the following lines in >your program: > > writeln ('Hello There!'); { print on screen } > writeln (Lst,'Hello There!'); { print on printer } > Or, you could write a procedure to print to both the console and the printer: type workstring = string[255]; procedure both(stuff: workstring); begin writeln(stuff); writeln(LST,stuff); end; You may want to use the compiler directive {$V-} with this which relaxes parameter checking and allows parameters of any string length to be passed. {See section 16.1.1 of manual about this}. The problem with this approach is that you may want to print both strings and numbers, which won't be automatically formatted as with the writeln command. --------------------- Gumby lives!!