How do I call an exe from my C program?

 
 
raj
Posts: 200
Joined: 2007-02-25
Points: 0
User is offline
How do I call an exe from my C program?

Hi,
I want to call notepad.exe/any executable from my C program. How do I do that?
Thanks


Posts: 29
Joined: 2007-02-25
Points: 0
User is offline
use the system call spawnl

use the system call spawnl as
spawnl("test.exe");
Samar


Posts: 36
Joined: 2007-02-15
Points: 0
User is offline
u can call any .exe file

u can call any .exe file using "system" function in windows tcc...


Posts: 3899
Joined: 2006-12-21
Points: 0
User is offline
Ya, and you can also do this

Ya, and you can also do this in linux while using GCC, you can use -

system("command_name");

to run that command but this is not a very good way of programming as you are assigning root privileges to the program. Instead it's always advisable to use execvp coammand and let the shell to the job for you.