Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!decwrl!world!jamesp From: jamesp@world.std.com (james M peterson) Newsgroups: comp.lang.pascal Subject: RE: output redirection Message-ID: <1990Nov10.222603.17030@world.std.com> Date: 10 Nov 90 22:26:03 GMT Sender: jamesp@world.std.com Organization: The World Lines: 33 The filename 'output' is the default output file. It defaults to dos' standard output file when you are not using the CRT unit. The CRT unit assigns output the a direct memory mapper. YOU can also re-assign the output file to change where the output goes. Try this: program test; begin writeln('Line one of output.'); { display on screen } assign(output,'out.put'); { assign output to file: out.put } rewrite(output); { zap existing and open of writing to} writeln('Line two of output.'); { ends up in out.put } close(output); { close it (do flush, etc too) } assign(output,''); { back to default output mode } rewrite(output); { zap & open for writing to } writeln('Line three of output.'); { display on screen } end. Try replacing 'out.put' with say 'lpt1' and gee it goes to the printer. For a robust system, you need to add error checking, etc. A general function can be made that: closes current output and opens new output. Like new_output(new_name:string12):boolean, where new_name is the new name of the output file and the func returns a true for success or false for failure. Add ERROR TRAPPING!!!!! jamesp@world.std.com