www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Trying to use execv

reply Joe <Joe_member pathlink.com> writes:
I have a little daemon, running on Windows, that spawns certain applications
based on hotkey assignment but main gets killed the first time execv is called. 
I.e., the application gets spawned but the daemon gets terminated. 

I've double checked that my daemon is working by spawning messages for each of
the assigned hotkeys, rather than apps, and it works fine this way. 

Thanks in advance for any help!

Joe
Apr 30 2005
parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
Joe wrote:

 I have a little daemon, running on Windows, that spawns certain applications
 based on hotkey assignment but main gets killed the first time execv is
called. 
 I.e., the application gets spawned but the daemon gets terminated. 
 
 I've double checked that my daemon is working by spawning messages for each of
 the assigned hotkeys, rather than apps, and it works fine this way. 
 
 Thanks in advance for any help!
 
 Joe
From the man of execv: "If any of the exec functions returns, an error will have occurred. The return value is -1, and the global variable errno will be set to indicate the error." The execv function isn't meant to return but terminate your program. What you're looking for is spawnv, or some of the Windows' family functions, WinExec of which is the simplest to use /+ though deprecated by MS +/ -- Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Apr 30 2005
parent "jpoirier" <aj.po charter.net> writes:
Great! Thanks for the info.
-Joe
"Tom S" <h3r3tic remove.mat.uni.torun.pl> wrote in message 
news:d50qih$163d$1 digitaldaemon.com...
 Joe wrote:

 I have a little daemon, running on Windows, that spawns certain 
 applications
 based on hotkey assignment but main gets killed the first time execv is 
 called. I.e., the application gets spawned but the daemon gets 
 terminated. I've double checked that my daemon is working by spawning 
 messages for each of
 the assigned hotkeys, rather than apps, and it works fine this way. 
 Thanks in advance for any help!

 Joe
From the man of execv: "If any of the exec functions returns, an error will have occurred. The return value is -1, and the global variable errno will be set to indicate the error." The execv function isn't meant to return but terminate your program. What you're looking for is spawnv, or some of the Windows' family functions, WinExec of which is the simplest to use /+ though deprecated by MS +/ -- Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Apr 30 2005