running a program from a program

Started by
6 comments, last by Infuscare 20 years, 6 months ago
how do you run another executable file from inside a program?
_________________________________________"You're just jelous because the voices only talk to me"
Advertisement
I suppose you could just use system("foobar.exe");




--{You fight like a dairy farmer!}

--{You fight like a dairy farmer!}

If you want another method, you could create a new thread and then run it that way. On a unix machine, the call is execlp or something like that. There''s tons of stuff on the net about it.

Brad
-brad
For windows teh best is the CreateProcess() function or you could use WinExec()
The monkeys are listening...
There is also what is called a "Script", where you run several executables within the main loop, without jeopardizing the initial program.

A Good scripting language is Python, Lua is also ok.

TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
What .h or .lib files do you need to use system(); ??

Im getting : C:\Cpp\bored3\main.cpp(94) : error C2065: ''system'' : undeclared identifier

I was thinking #include <windows.h> but its not working.

normal_toes@hotmail.com
for createprocess() or winexec() i imagine the program to run is the parameter...?

what about system, how does that work...
I know u can do system("pause") to pause, but can you
enter just any command that you could use at a command
prompt *wondering if pause is a command*, nehoo thx
was just curious...

i meant in C by the way...
_________________________________________"You're just jelous because the voices only talk to me"
Umm I think that's defined in stdlib.h, by the way that's just like typing something into your DOS prompt that's why it works, though you have more control with CreateProcess() and if you want to find out how to use it look it up in MSDN.
And here's the one for WinExec

[edited by - FtMonkey on October 9, 2003 12:00:16 AM]
The monkeys are listening...

This topic is closed to new replies.

Advertisement