home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / msdos / programm / 11867 < prev    next >
Encoding:
Text File  |  1993-01-07  |  2.2 KB  |  79 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!gatech!darwin.sura.net!jvnc.net!netnews.upenn.edu!netnews.cc.lehigh.edu!ns1.cc.lehigh.edu!jmt7
  2. From: jmt7@ns1.cc.lehigh.edu (JOHN M. TROIANO)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: question on spawning DOS from C prog
  5. Message-ID: <1993Jan7.140524.15787@ns1.cc.lehigh.edu>
  6. Date: 7 Jan 93 14:05:24 GMT
  7. Organization: Lehigh University
  8. Lines: 69
  9.  
  10. In article <tim.36.726368023@tim.src.utah.edu>, tim@tim.src.utah.edu (Tim Ma) wr
  11. ites:
  12. >>Subject: Re: question on spawning DOS from C prog
  13. >>Date: 6 Jan 93 10:50:55 GMT
  14. >>jmt7@ns1.cc.lehigh.edu (JOHN M. TROIANO) writes:
  15. >>
  16. >>>For example, after spawning DOS the user would
  17. >>>see:
  18. >>>            <Type EXIT to return to program>      <--this would appear
  19. >>>                                                     each time <RET> hit
  20. >>>            C:\
  21. >>>    Is there, perhaps, a parameter to COMMAND.COM to do this?
  22. >
  23. >Reply was:
  24. >------------------------------------------------------------------------
  25. >>In your function declare something like:
  26. >>
  27. >>      static char prompt[]="PROMPT=<Type EXIT to return to program>$_$_$P";
  28. >>
  29. >>and before the spawnl() do a
  30. >>
  31. >>      putenv(prompt);
  32. >>
  33. >>to get exactly what you want.
  34. >>
  35. >>Greetings,
  36. >>Wolfgang
  37. >>--
  38. >>siebeck@infoac.rmi.de (Wolfgang Siebeck)
  39. >
  40. >Is this possible?  It was my understanding that 'spawn' called a new command
  41. >shell so any changes in the environment would not be carried over.
  42. >
  43. >I've always used 'spawnl' with the 'e' suffix to set or pass on environment
  44. >variables.
  45. >
  46. >Curiously,
  47. >
  48. >Tim Ma
  49. >Associate Programmer
  50. >University of Utah
  51. >Email:  tim@src.cppa.utah.edu
  52. >
  53.  
  54. Hi, I am the original poster of this problem: this is especially to
  55. Tim and Wolfgang. I tried the code below (which is I think what both
  56. of you guys are suggesting) but it does'nt work (the new prompt
  57. string is ignored). Any ideas?     - John.
  58.  
  59. #include <stdio.h>
  60. #include <process.h>
  61. #include <dos.h>
  62. #include <stdlib.h>
  63.  
  64. int main( int argc, char *argv[], char **envp )
  65. {
  66.  
  67. printf( "\ninside main, spawning DOS\n" );
  68. sleep( 2 );
  69.  
  70. putenv( "prompt=$_type EXIT to return to program $_$_$p$g" );
  71.  
  72. spawnlpe( P_WAIT, "command.com", NULL, envp );
  73.  
  74. printf( "\nback from spawn!\n" );
  75.  
  76. sleep( 2 );
  77.  
  78. }
  79.