home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.univie.ac.at!apap4.pap.univie.ac.at!roesel
- From: roesel@apap4.pap.univie.ac.at
- Newsgroups: comp.lang.pascal
- Subject: Re: can't get EXEC to work
- Message-ID: <1992Sep2.182522.19@apap4>
- Date: 2 Sep 92 18:25:22 GMT
- References: <la5469INNgd2@langtry.cs.utexas.edu>
- Organization: Vienna University Computer Center
- Lines: 51
-
- In article <la5469INNgd2@langtry.cs.utexas.edu>, joel@cs.utexas.edu (Joel Daniel Just) writes:
- > I am having trouble getting the EXEC command to work in Turbo Pascal v5.0 on
- > the PC. Here is an example program:
- >
- > PROGRAM TEST;
- > USES DOS;
- > BEGIN
- > EXEC('dir','');
- > WRITELN('DONE')
- > END.
- >
- > When I run this program, 'DONE' is printed, and nothing else happens. The
- > EXEC command doesn't seem to be executed, no matter what I put in between the
- > two sets of quotes in the EXEC call. Even if I put garbage between the
- > quotes, I don't get an error. I just get 'DONE' and that's it.
- >
- > Any suggestions?
-
-
- If you do not change the memory settings, Turbo Pascal uses all memory for
- the heap. In this case there is no space to load a program with EXEC.
- Therefore you must alter the memory settings, e.g. with the compiler directive
- {$M}. If you do not need the heap, you can write {$M 16384,0,0}.
-
- If you want to exec an internal command like DIR, then write
- exec('c:\dos\command.com','/c dir');
- or even better
- exec(getenv('comspec'),'/c dir');
-
-
- program example; { for exec }
- uses dos;
-
- {$M 16384,0,0}
-
- begin
- swapvectors;
- { exec('bsp.exe',''); } { an external command }
- exec(getenv('comspec'),'/c dir'); { an internal command }
- swapvectors;
- writeln(doserror); { doserror = 0, if all is right }
- end.
-
-
- I hope, this will help you
-
- Martin
-
- ------------------------------------------------------------------------------
- Martin Roesel, Institute of Solid State Physics, University of Vienna, Austria
- roesel@apap1.pap.univie.ac.at
-