Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpcea!hpfcdc!hpldola!russ From: russ@hpldola.HP.COM (Russell Johnston) Newsgroups: comp.lang.pascal Subject: Re: universal writeln in Turbo Pascal? Message-ID: <11490001@hpldola.HP.COM> Date: 16 Mar 88 17:57:42 GMT References: <3297@okstate.UUCP> Organization: HP Elec. Design Div. -ColoSpgs Lines: 30 > This is a Turbo Pascal question: > I want to be able to use one writeln statement to write to the printer, > screen, or a file. What I am thinking of is something like this: > writeln(fd,'Hello') The following works in Turbo 3.0: var fb:text; DISK,PRINTER:boolean; begin . . . if DISK then assign(fb,'myfile.txt') else if PRINTER then assign(fb,'LST:') else assign(fb,'CON:'); writeln(fb,'Hello'); If anyone has a solution for Turbo 4.0, I would like to see it.