How can we run a C program on clicking a button in any GUI?
In the click handler for the control, add something that starts the C program. How to do this is platform specific, and you didn't specify which platform you are interested in. For Windows, there are several ways of activating something:
WinExec() [don't use this any more]
CreateProcess() [and related]
Google is your friend for these. I assume you know what to do...
1. Are you thinking of running C-code (automatic compile and link) or are you talking about compiled application ?
I asssume you mean writing Code in C that displays a GUI with a button ?
a. Are you searching for a way of programming a button independent from Operation System ?
You should use a library such as wxwindows, opengl or something like that.
b. You can call system() from stdlib.h independent from OS.
Depending on the Operation System you have to call different System-Calls.
For Unix you can call fork()/exec() for Windows you can use CreateProcess().
Edited 16-Feb-13 14:44pm
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)