system() and no console ?



I'm very new to C and am having a hard time figuring out how to pass a command to the underlying OS so as it doesn't keep the console window open. By double-clicking from Windows Explorer, I want the other process to just spawn and the console to close.

For example, on Windows XP, I make the following call:

  system(my_command);

where my_command = 'my_program.exe'.
But in Windows the console window stays open until my_program.exe exits. I guess that makes sense but how would I change my_command or is there an alternative to system() that would spawn a new process and then immediately return so my application can complete and close the console? I tried 'my_program.exe &', but that didnt work either.


Thanks!
.



Relevant Pages

  • Re: hiding app window
    ... mudassir a écrit: ... i want to spawn an executable (system needs to be portable across ... win/unix), and i want to hide the window of this application(a console ... For example i want to spawn cmd.exe, and hide its console window, and ...
    (comp.unix.programmer)
  • Re: system() and no console ?
    ... >command to the underlying OS so as it doesn't keep the console window ... By double-clicking from Windows Explorer, ... >process to just spawn and the console to close. ... Anything to do with underlying OS's and console windows is outside the ...
    (comp.lang.c)
  • hiding app window
    ... i want to spawn an executable (system needs to be portable across ... win/unix), and i want to hide the window of this application(a console ... For example i want to spawn cmd.exe, and hide its console window, and ...
    (comp.unix.programmer)
  • Re: anticipating an unfriendly queue
    ... had to do that stuff at all, have usually been with something like cygwin, ... Where in the standard does it say "must be used with a command line"? ... displaying output, and terminating immediately, closing the console window. ...
    (comp.lang.c)
  • Re: Novice cant compile and run
    ... > The reason for my post here is, ... > tried to compile Mr. Dippold's code. ... > WPCRACK.exe" runs in a console window, but to work correctly, I need to ... > add some command line parameters. ...
    (comp.lang.cpp)