Running a DOS program from within Pascal - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Running a DOS program from within Pascal

Hello everyone.



I've not used Pascal for a long time now, and I can't remember how to fire off a DOS program from within a Pascal program. Can somebody please help?



I remember there being a {} command at the top, and the calling code was something like;



swapvectors;

exec('comspec','/c command-to-run.exe');

swapvectors;



The above code compiles, but the {} directive is needed else the code does nothing. Anyone?



Rgds,

MrH


Comments

  • : Hello everyone.

    :

    : I've not used Pascal for a long time now, and I can't remember how to fire off a DOS program from within a Pascal program. Can somebody please help?

    :

    : I remember there being a {} command at the top, and the calling code was something like;

    :

    : swapvectors;

    : exec('comspec','/c command-to-run.exe');





    You should use getenv('comspec') instead of 'comspec'.

    Getenv is defined in dos unit.

    This should rsolve the problem. But if DOS says, that there is not enough memory, then write in to the begginning of the program such conditional:



    {$m stacksize,minheapsize,maxheapsize}



    where stacksize should be littlebit more than your largest variable and minheapsize/maxheapsize = minimum/maximum heap required for new/getmem.



    : swapvectors;

    :

    : The above code compiles, but the {} directive is needed else the code does nothing. Anyone?

    :

    : Rgds,

    : MrH

    :






  • Look in the topic: RE:HELP!!!!!!!!!!!!!!-meisi

    a few lines below your message.


Sign In or Register to comment.