Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!elroy!orion.cf.uci.edu!paris.ics.uci.edu!bonnie.ics.uci.edu!posert From: posert@bonnie.ics.uci.edu (Bob Posert) Newsgroups: comp.sys.ibm.pc Subject: Re: DOS shell from within application Message-ID: <999@paris.ics.uci.edu> Date: 29 Nov 88 18:15:51 GMT References: <1549@mit-caf.MIT.EDU> Sender: news@paris.ics.uci.edu Reply-To: posert@bonnie.ics.uci.edu (Bob Posert) Organization: University of California, Irvine - Dept of ICS Lines: 36 In article <1549@mit-caf.MIT.EDU> Jim Vlcek writes: >I would like to incorporate into a program I am writing in MSC5.0 >(currently in small model), the ability to ``pop out'' into a DOS >shell and then return to the application by issuing the DOS EXIT >command. > [...] >Things like: > > char *out_mesg; > out_mesg = "Hello, world\n"; > >get corrupted, I suspect that this is due to such constant data being >located in a centralized place in memory. The following program seems to work using Turbo C 1.0 under PC-DOS 3.1: ======= #include#include #include main(){ char *const_str; char *command; const_str = "This is a constant string\n"; command = getenv("COMSPEC"); printf("\n\nType Exit to leave subshell\n"); spawnl(P_WAIT, command, command, NULL); printf("%s", const_str); } ======= You may want to add some error checking :-). --Bob -- Bob Posert I'm: posert@bonnie.ics.uci.edu or {sdcsvax|ucbvax}!ucivax!bonnie!posert