home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / msdos / programm / 11830 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  1.3 KB

  1. Path: sparky!uunet!gossip.pyramid.com!olivea!hal.com!darkstar.UCSC.EDU!cats.ucsc.edu!spencer
  2. From: spencer@cats.ucsc.edu (Michael Spencer)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Equivilent of UNIX exec shell cmd
  5. Message-ID: <1if7f4INNg44@darkstar.UCSC.EDU>
  6. Date: 6 Jan 93 18:12:52 GMT
  7. References: <1992Dec31.142534.15978@msw>
  8. Organization: University of California, Santa Cruz
  9. Lines: 30
  10. NNTP-Posting-Host: si.ucsc.edu
  11.  
  12.  
  13. PROBLEM: How do you call a batch file from a C program
  14.         without leaving the batch file "live" ?
  15.  
  16. ANSWER:  You can't.
  17.  
  18. WORK AROUND:
  19.         1) The batch file name + path MUST be less than 16 chars
  20.         2) Push the batch file name on the keyboard stack 
  21.           (requires 286 or better).
  22.          3) Terminate the C program
  23.         4) The batch file on conclusion calls the C program with 
  24.           an argument which places the program in the proper
  25.           position.
  26.  
  27.    What happens is that the C program terminates, command.com
  28. looks for input, the keyboard stack provides the input, the batch
  29. file is called by the opSys, and the final action of the batch file
  30. is to recall the C program. Perpetual motion.
  31.  
  32.     Note: (1) Some keyboard stacks may be larger than 16 chars
  33.             but you can't count on this.
  34.          (2) The chars pushed on the keyboard stack are NOT
  35.             ASCI, they must be keyboard codes
  36.  
  37.                     Mike Spencer
  38.                     spencer@cats.ucsc.edu
  39.  
  40.  
  41. D
  42.