This illlustrates how you can do this, and passing a parameter to the callback as well. Here is the basic idea:
Code:
#define ALLS_WELL 1
#define SOME_ERROR 0
void Launch( void callback_fn(int), int callback_param)
{
printf("Launching Utility...\n\n");
//...do work...
if(1 == 1)/*some condition*/
callback_param = ALLS_WELL;
else
callback_param = SOME_ERROR;
callback_fn( callback_param );
}
void Callback(int param)
{
printf("Entering Callback...\n\n");
if(param == ALLS_WELL)
{
printf("Launch() was successful...\n\n");
}
else
{
printf("Launch() failed...\n\n");
}
}
int main()
{
int param; //..fill in later...
Launch(Callback, param);
getch();
return 0;
}