|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to execute a programme within a programme ?
How do I execute a programme within a C programme ?
any good docs articles on this ? |
|
#2
|
||||
|
||||
|
Quote:
If you are using a DOS/Windows C compiler, it should also have implemented system(). Just read the help file/documentation on it. When you use system(), the calling process is still there and can check the status returned by the system() call. However, if you want to have the called program replace the calling program, then look into the exec* family of functions. |
|
#3
|
||||
|
||||
|
I recall reading a few weeks ago that the system command is VERY slow. Be sure to read the documentation like dwise1_aol suggested. I think it provides an alternative.
__________________
Jason Doucette / Xona.com™ - Programming Windows Errata Addendum "Discussion is an exchange of knowledge; argument is an exchange of ignorance." |
|
#4
|
||||
|
||||
|
The man page on Linux also mentions some gotcha's regarding signals, I think. It didn't apply to what I was doing, so I didn't pay much attention.
And don't just read the documentation, but also write some test code. |
|
#5
|
|||
|
|||
|
You can use shell execute to run a program from within a program. For documentation, visit http://msdn.microsoft.com/library/d...hellexecute.asp
ShellExecute(NULL, "open", "C:\\Program Files\\Internet Explorer\\iexplore.exe", NULL, NULL, SW_SHOW) |
|
#6
|
||||
|
||||
|
jason i noticed u said system is very slow? what about execve?
|
|
#7
|
||||
|
||||
|
Quote:
In both Windows and Linux, execve would replace the calling program. In Linux we'd couple it with a fork, but Windows doesn't do forks -- there's CreateProcess which works quite differently. However, Jason_G never replied, so we don't know what OS he's running or whether exec* would work for him or not. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > how to execute a programme within a programme ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|