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

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!ncoast!brown
  3. From: brown@NCoast.ORG (Stan Brown)
  4. Subject: Re: question on spawning DOS from C prog
  5. Organization: Oak Road Systems, Cleveland Ohio USA
  6. Date: Sat, 9 Jan 1993 14:47:07 GMT
  7. Message-ID: <C0LD2K.6Cr@NCoast.ORG>
  8. References: <1iedifINNmoi@infoac.rmi.de> <o0q1wB2w165w@cybrspc.uucp>
  9. Lines: 44
  10.  
  11. In article <o0q1wB2w165w@cybrspc.uucp> roy%cybrspc@cs.umn.edu (Roy M. Silvernail) writes:
  12. >siebeck@infoac.rmi.de (Wolfgang Siebeck) writes:
  13. >
  14. >> In your function declare something like:
  15. >> 
  16. >>     static char prompt[]="PROMPT=<Type EXIT to return to program>$_$_$P";
  17. >> 
  18. >> and before the spawnl() do a
  19. >> 
  20. >>     putenv(prompt);
  21. >> 
  22. >> to get exactly what you want.
  23. >
  24. >This will, of course, require that you have spare room in your
  25. >environment block.  Applications are passed a _copy_ of the environment
  26. >by command.com, which has all spare space trimmed off.  Thus, the
  27. >putenv() call may very well fail.
  28.  
  29. Well, anything _may_ fail; but it's unlikely that the putenv call will.
  30.  
  31. I've long since lost track of which compiler we were talking about.  But
  32. Microsoft C _putenv makes it quite clear that what is modified is the
  33. run-time library's _copy_ of the environment. From the description of
  34. wht happens, it appears that the _putenv( ) will succeed unless the heap
  35. space is exhausted.
  36.  
  37. Both BC++ 2.0 and MSC++ 7.0 manuals specifically say that putenv/_putenv
  38. can be used to add an environment variable; neither warns about running
  39. out of space.  From this I conclude that BC++'s version works similarly
  40. to MSC++'s on its copy of the environment that it received from DOS, not
  41. on the (space-limited) environment that it received from DOS.
  42.  
  43. Department of amplification:
  44.  
  45. In an earlier follow-up I said that spawn would create a secondary
  46. command shell.  This is true when what you spawn is COMMAND.COM; but
  47. that was not what the original question was about.  My comment was
  48. incorrect in that context.
  49.  
  50. -- 
  51. Stan Brown, Oak Road Systems                      brown@Ncoast.ORG
  52. Cleveland, Ohio, USA
  53.  
  54. "Life!  Don't talk to me about life!"
  55.