From: <jsv...@be...> - 2001-04-25 20:44:15
|
On 25 Apr 2001, at 12:04, min...@li... wrote: > what is the correct command for starting a background process > from a mingw program for ALL windows systems: Tricky. Generally depends a bit on what kind of process it is and what you want from it. > system(cmd); > cmd='start myprocess' This works, provided that you know that myprocess exists in $PATH, and, as you have pointed out, that you don't need the return code. > or > cmd='myprocess &' ? This doesn't make any sense. The only thing you will accomplish is to find '&' in argv[1] of your program, which I assume is not what you intended. & is /bin/sh-ish for running in the background, the standard windows command processors doesn't provide such facilities. Note that system() does nothing more intelligent than passing your string as a parameter to $COMSPEC. Windows suffers in this case from being two systems for the price of one. You have the console-subsystem that works much like dos or unix, passing return values to the command processor, and you have "real" windows that works with it's own message-model. You may want to investigate the CreateProcess(), execl() and spawnl() API calls. Jon Svendsen |
From: Earnie B. <ear...@ya...> - 2001-04-30 19:40:22
|
Please, when responding to a subject from the digest replace the subject line in you email client with the appropriate line. Earnie. jsv...@be... wrote: > > On 25 Apr 2001, at 12:04, min...@li... wrote: > > > what is the correct command for starting a background process > > from a mingw program for ALL windows systems: > > Tricky. Generally depends a bit on what kind of process it is and > what you want from it. > > > system(cmd); > > cmd='start myprocess' > > This works, provided that you know that myprocess exists in > $PATH, and, as you have pointed out, that you don't need the > return code. > > > or > > cmd='myprocess &' ? > > This doesn't make any sense. The only thing you will accomplish > is to find '&' in argv[1] of your program, which I assume is not what > you intended. & is /bin/sh-ish for running in the background, the > standard windows command processors doesn't provide such > facilities. Note that system() does nothing more intelligent than > passing your string as a parameter to $COMSPEC. > > Windows suffers in this case from being two systems for the price > of one. You have the console-subsystem that works much like dos > or unix, passing return values to the command processor, and you > have "real" windows that works with it's own message-model. > > You may want to investigate the CreateProcess(), execl() and > spawnl() API calls. > > Jon Svendsen > > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options at: > http://lists.sourceforge.net/lists/listinfo/mingw-users _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |