ShellExecute C
What is the syntax to run a program in C?
I want my C program to execute another program I am a noob at C/C++ programming, My friend said something about ShellExecute(handle, NULL, path_to_folder, NULL, NULL, SW_SHOWNORMAL) But I don't know what that is... how would I execute a program named hi ??? Thanx -- Canadian Daemon |
|
Well its been a while since college but aren't C programs just executables? If so you would just do:
./hi if the C programs name was hi. |
Ya, but in my other program, what is the syntax to execute another program... do i go..
int main() { cin >> programname; ./programname } ???? |
Oh you mean in the source code itself? This is a programming question right? Ummm...well I'm no c programming expert but I do remember a function that might work for this.
int ok; int main() { ok=system("programname") } I'm not sure if thats the exact syntax but I know the system function passes the argument directly to the command line. |
Thanx, what header is that in?
When I compile my program, I geth hi.c: In function `int main()': hi.c:11: `ok' undeclared (first use this function) hi.c:11: (Each undeclared identifier is reported only once for each function it appears in.) #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <iostream.h> #include <stdlib.h> #include <shellapi.h> int main() { ok =system("emacs"); return EXIT_SUCCESS; } Thanx |
I think it is in
#include <stdio.h> |
Thanx
I didn't need the ok= though, Thanx for the help |
All times are GMT -5. The time now is 11:00 AM. |