Skip to main content
GameDev.net gamedev.net
🔒 Locked

Borland C++ Builder 5 function question

Started by Johnnyl_ro Apr 18, 2004 at 1:21 PM 3 replies 350+ views
Original Post
Johnnyl_ro
Johnnyl_ro
Does anybody know how to execute an external exe from within the application? What function do I use?
SiCrane
SiCrane
You can use either CreateProcess(), ShellExectue() or any of the exec() family of functions.
Peregrine
Peregrine
I''m not sure what platform you''re programming for, but if it''s Win32, there are a number of options.

You can uses the system() function, which invokes the OS to execute a program. You need to include stdlib.h to do this.

If want greater control over the process that you are running, you can use spawnl() or execl (). These functions are available when you include process.h .

In practice, I''ve never really used these functions so I don''t know how portable they are. My guess is they should work in UNIX as well, but they should definitely work in Win32.

Hope this helps!
iaretony
iaretony
The exec calls work fine, except that their is no fork() call in win32, so the process that calls exec is the one used to actually run the binary... and when that binary exit()''s, you''re app is done.

To get around this use "CreateProcess".

Tony
Johnnyl_ro
Johnnyl_ro
Thanks everyone, this should do it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.