0

I know in C++ there is a function

system("example.exe");

that runs another program, put it requires the include stdlib.h.

Because I am already including 'windows.h', is there an equivilant to the system() function in Windows?

  • 1
    Actually, since this has a "C++" tag, it's `std::system()` and ``. – sbi Sep 22 '09 at 23:23
  • Actually, since this has a "C++" tag, there is a function `system` defined in the root namespace in the `` header. You may prefer the other way of including it (like any sensible C++ programmer), that's up to you. – Steve Jessop Sep 23 '09 at 00:39

3 Answers3

15

There is CreateProcess to run a specific executable, or ShellExecute to run programs or open documents with their associated program.

If portability to other platforms is any issue at all, I'd stick with system. #including stdlib.h won't kill you ;)

peterchen
  • 40,917
  • 20
  • 104
  • 186
4

Check the MSDN page for CreateProcess for more information

ChrisF
  • 134,786
  • 31
  • 255
  • 325
0

I think you're looking for CreateProcess?

lod3n
  • 2,893
  • 15
  • 16