Re: Parallelling system_exec
- Posted by Bob Elia <bobelia200 at netzero.net> Jun 29, 2004
- 427 views
At 06:17 PM 6/28/04 -0700, you wrote: > > >posted by: Andy Serpa <ac at onehorseshy.com> > >Juergen Luethje wrote: > > > > > > As I wrote, it does so on my *Windows* system. (It does so on my PC > > under DOS, too). All 4 programs are executed almost simulataneously. > > Which Windows version do you use (2000 or XP, I believe)? > > >I understand that you're using Windows, but you didn't say if you were >using the Windows interpreter exw.exe (I am) or ex.exe. I'm using WinXP >Pro, but I don't think it was any different when I had Win98. The docs >seem to indicate that it waits for an exit value from the spawned program... I believe Andy is correct.
system("notepad.exe", 2)
This appears not to block because what is happening here is that the command shell called by system() is returning as soon as it has launched notepad.exe, a Win32 program. Try the following:
puts(1, "calling \"system(\"ex.exe\", 2)...\n") system("ex.exe", 2) puts(1, "calling \"system(\"notepad.exe\", 2)...\n") system("notepad.exe", 2) puts(1, "\n\n\n\n") clear_screen() ? 99 while get_key()= -1 do end while
This behaves the same whether I run it with EX.EXE or EXW.EXE ( I think; it's late and I'm tired). The call to system("ex.exe", 2) blocks until you press ENTER. EX.EXE is an extended DOS program and therefore blocks. This all appears to be the same results you would get by typing the names of the programs at the command line in a DOS box. Bob