tags:

views:

41

answers:

1

I want to call one command(user defined) from C program(Windows). Can you tell me the function available?

+2  A: 

system() is the simplest way to call external programs.

It's a matter of doing something like:

system ("runme.exe");

The Win32 API has a lot of process control calls as well, which give you better control and monitoring. Look for CreateProcess and its brethren.

paxdiablo
you can pass complete path to system(). In the above case i.e `system("runme.exe")` runme.exe must be present in current folder or in the system path (defined by PATH environment variable). But if your exe resides at some other place, you can specify complete path to it in system() call e.g `system("c:\path\to\file\runme.exe")`
binW
My opinion on system(): http://stackoverflow.com/questions/2923843/can-i-use-boost-library-for-crossplatform-application-executing/2925579#2925579tl,dr version: avoid it.
Matteo Italia