kjeld@iesd.auc.dk (Kjeld Flarup) (02/05/90)
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