Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!sdcc6!sdcc19!sdcc15!pa1804 From: pa1804@sdcc15.ucsd.edu (pa1804) Newsgroups: comp.lang.pascal Subject: Re: DUEL OUTPUT Summary: a procedure will do it Message-ID: <1265@sdcc15.ucsd.edu> Date: 4 Mar 89 23:41:57 GMT References: <18461@adm.BRL.MIL> Organization: University of California, San Diego Lines: 63 In article <18461@adm.BRL.MIL>, pmancini@lynx.northeastern.edu writes: > > I would like to know what is (if possible) standard > implementation in PASCAL to send text output simultaneously > to the screen and to a LST device or file. I hate having to > write lines twice, such as; > > writeln('abcdefg12345'); {goes to screen} > writeln(lst,'abcdefg12345'); {goes to printer} > > Is there anyway I can send the output to both without > writing the line twice? In programs which print a lot of text > to the screen and the printer it gets very tedious typing everything > over and over again. You can write a procedure that will send the output to both the screen and the other output device: Procedure WriteAll { pass variables that are necessary } Begin { WriteAll } writeln(argument); { this goes to the screen } writeln(OutputDevice1, argument); { this goes to OutputDevice1 } writeln(OutputDevice2, argument); { this goes to OutputDevice2} end; { WriteAll } .. .. .. .. begin { main program } .. .. WriteAll; ( variables ) .. .. end. { main program } As you can see, by using the procedure WriteAll you can send output to as many destinations as you want. George Chen pa1804@sdcc15.UCSD.EDU PO BOX 4474 La Jolla, CA 92037