pmk@cip-s01.informatik.rwth-aachen.de (Michael Keukert) (09/24/89)
In Turbo-Pascal 5.0 all you need are the following lines: In the beginning of the Program, set the line> {$M x,z,y} where X is the stack and z,y are the heap-start and the heap-end. In an application of mine I used for example {$M 51200,0,0}. More Information in the Borland-Handbook. When you`re going to start your external program, write the lines> SwapVectors; Exec(GetEnv(`COMSPEC`),`[complete path & filename + extension]`); SwapVectors; With this few lines you`re able to start whatever external program you like. The only thing to do is to experiment a bit with the first argument in the {$M x,z,y} compiler instruction. Good luck ... PMK@CIP-S01.INFORMATIK.RWTH-AACHEN.DE ! Warning! UNIX-Newcomer! Michael Keukert of 2:242/2 (Fido-Net) ! No flames please .... PMK@EIKO.ZER (Zerberus-Net) ! ... I'm still learning.
d88-eli@nada.kth.se (Erik Liljencrantz) (09/24/89)
In article <1319@rwthinf.UUCP> pmk@cip-s01.informatik.rwth-aachen.de (Michael Keukert) writes: >In Turbo-Pascal 5.0 all you need are the following lines: [trimmed...] > When you`re going to start your external program, write the lines> > > SwapVectors; > Exec(GetEnv(`COMSPEC`),`[complete path & filename + extension]`); > SwapVectors; Almost correct. Keep SwapVectors, but use Exec in one of two ways. Either Exec can launch your program directly: Exec('\BIN\CHKDSK.COM','/F'); => Run CHKDSK /F With this approach the exact path and extension has to be known (of course you don't have to hardcode the path...). The other way is to let the command interpreter do the work (that is what COMSPEC contains, normally COMMAND.COM): Exec(GetEnv('COMSPEC'),'/C '+ProgramName); ^^ Switch to COMMAND.COM,. Has to be there... The command interpreter accepts commands the same way they are entered after the prompt (even internal commands like DIR can be executed). That is, the PATH is searched and the extension shouldn't be in ProgramName. Batchfiles can also be executed this way. > With this few lines you`re able to start whatever external program > you like. The only thing to do is to experiment a bit with the first > argument in the {$M x,z,y} compiler instruction. Almost true. If your program needs any heap space, you will have to decide how much at compile time (and experiment with the z & y numbers too). There is no easy way to change this at runtime (though it's possible to shrink the heap, then Exec, and then restore the heap...) >Good luck ... >PMK@CIP-S01.INFORMATIK.RWTH-AACHEN.DE ! Warning! UNIX-Newcomer! >Michael Keukert of 2:242/2 (Fido-Net) ! No flames please .... >PMK@EIKO.ZER (Zerberus-Net) ! ... I'm still learning. --- Erik Liljencrantz | "No silly quotes!!" d88-eli@nada.kth.se | Embraquel D. Tuta