-1

How do I open a process that isn't connected with my program in C? for example: if the user enter the following input: start C:\Windows\calc.exe

then the calculator will open. thanks.

  • do you want to open the process (using OpenProcess) or do you want to start it (CreateProcess)? – Ferenc Deak Nov 06 '12 at 07:50
  • sample: http://nikisurf.blogspot.com/2011/10/c-program-to-open-calculator.html – 4b0 Nov 06 '12 at 07:55
  • possible duplicate of [How do I call ::CreateProcess in c++ to launch a Windows executable?](http://stackoverflow.com/questions/42531/how-do-i-call-createprocess-in-c-to-launch-a-windows-executable) – Dietrich Epp Nov 06 '12 at 08:05

3 Answers3

1

Processes are not known by the C standard. You can code in standard C for a system without processes (e.g. bare metal, or MS-DOS).

On Posix compliant systems, you could use popen(3) (with fscanf and pclose).

You may also use the system(3) function.

Your operating system may have a non-Posix interface. Please dive into your system's developer documentation.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
0

You can try createProcess on Windows.Also look into this thread & this previously asked question.

Community
  • 1
  • 1
Sorter
  • 9,704
  • 6
  • 64
  • 74
0

Try to use the system() function. MSDN Link

Alex
  • 9,891
  • 11
  • 53
  • 87