Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.