Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!snorkelwacker!bloom-beacon!eru!luth!sunic!dkuug!iesd!kjeld From: kjeld@iesd.auc.dk (Kjeld Flarup) Newsgroups: comp.sys.ibm.pc,aus.computers.ibm-pc Subject: Re: Redirecting Screen Output Message-ID: <1990Feb5.145230.851@iesd.auc.dk> Date: 5 Feb 90 14:52:30 GMT References: <219cs-sunb@massey.ac.nz> Reply-To: kjeld@iesd.auc.dk (Kjeld Flarup) Organization: Mathematics & Computer Science, University of Aalborg Lines: 31 In article <219cs-sunb@massey.ac.nz> M.Jones@massey.ac.nz writes: >I want to know how to redirect characters sent to the screen to a file >without using the redirection ('>') character. Hopefully, there is a >public domain program that would do this. > >Alternatively, could someone tell me if it is possible to execute another >program from within a Turbo Pascal (v5.50) program and use the '>' for >redirection. Using the Exec function seems to ignore any redirection >characters entered as part of the parameter string. The general way to do this should be to close the output, and to reopen it to the redirection file close( output ); assign( output, 'redirect.fil' ); rewrite( output ); This should make the DOS handle for standard output point to a file instead of the console. When executing a child program this redirection is inherited. The same can be done for input and error. If this doesn't work it may be nessecary to do some direct acces to DOS. I do not guarantee that this works but try playing with it, and if it fails let me know and I will find out for sure how it is done. BTW make sure to test on a program which uses DOS for output and not BIOS or direct screen access. -- * I am several thousand pages behind my reading schedule. * Kjeld Flarup Christensen kjeld@iesd.auc.dk