Path: utzoo!mnetor!uunet!husc6!yale!cmcl2!rutgers!pbox!okstate!garnett From: garnett@a.cs.okstate.edu (John Garnett) Newsgroups: comp.lang.pascal Subject: universal writeln in Turbo Pascal? Message-ID: <3297@okstate.UUCP> Date: 13 Mar 88 20:18:46 GMT Distribution: na Organization: Oklahoma State Univ., Stillwater Lines: 28 Keywords: turbo pascal writeln question 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') where by changing the value of fd I could cause the writeln to act like writeln(lst,'Hello'); or writeln(outfile,'Hello'); where outfile is defined : var outfile:text; or writeln('Hello') { to the screen }. The reason I would like to be able to do this is because I am tired of writing three separate sections which each do essentially the same thing. I don't know what type fd would have to be or if this is even possible in Turbo Pascal. Any ideas or solutions would be appreciated. Thanks. +-------------------------------------------------------------------------+ | john garnett Internet: garnett@a.cs.okstate.edu | | computing and information sciences UUCP: {cbosgd, ihnp4, rutgers}! | | oklahoma state university okstate!garnett | +-------------------------------------------------------------------------+ | "Since the mathematicians have attacked the relativity theory, | | I myself no longer understand it." - Albert Einstein | +-------------------------------------------------------------------------+