home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / pascal / 5145 < prev    next >
Encoding:
Text File  |  1992-09-01  |  1.7 KB  |  47 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!fmsrl7!lynx!nmsu.edu!death
  3. From: death@acca.nmsu.edu (Jeff Garzik)
  4. Subject: Re: can't get EXEC to work
  5. Message-ID: <1992Sep1.105502.7542@nmsu.edu>
  6. Sender: usenet@nmsu.edu
  7. Organization: New Mexico State University
  8. X-Newsreader: Tin 1.1 PL5
  9. References: <la5469INNgd2@langtry.cs.utexas.edu>
  10. Date: Tue, 1 Sep 1992 10:55:02 GMT
  11. Lines: 34
  12.  
  13. Joel Daniel Just (joel@cs.utexas.edu) wrote:
  14. : I am having trouble getting the EXEC command to work in Turbo Pascal v5.0 on
  15. : the PC.  Here is an example program:
  16. : PROGRAM TEST;
  17. : USES DOS;
  18. : BEGIN
  19. :    EXEC('dir','');
  20. :    WRITELN('DONE')
  21. : END.
  22. : When I run this program, 'DONE' is printed, and nothing else happens.  The
  23. : EXEC command doesn't seem to be executed, no matter what I put in between the
  24. : two sets of quotes in the EXEC call.  Even if I put garbage between the
  25. : quotes, I don't get an error.  I just get 'DONE' and that's it.
  26.  
  27. This question pops up every so often...  You need to make sure you have
  28. enough memory to execute the Exec call.  Try adding the {$M 8192,0,0}
  29. directive at the start of the program, as well as SwapVectors calls before
  30. and after the Exec call.  
  31.  
  32. Finally, never forget to check the DosError variable.  This probably would
  33. have told you what you need to know in the first place.
  34.  
  35. However, except for some small jobs, you will want heap and the ability to
  36. Exec, such as creating a DOS shell.  TurboPower software offers a public
  37. domain "ExecSwap" unit which will do just that with a minimum of hassel. 
  38. Their Object Professional also has a lot of helpful Exec routines.
  39.  
  40. --
  41. "Only sheep need a leader." - Nomeansno
  42.  
  43. death@acca.nmsu.edu
  44.  
  45.