From: Arka Roy on
I am generating executable programs using Simulink / RTW.

I start the programs on the command line, for example:
../myprogram

I just stop them using Ctrl-C.

I want to stop them cleanly, and have them go through my exit function where I clean up and disconnect from external devices.

Is there a way to do this? It doesn't have to be using Ctrl-C either, any way of shutting down is acceptable (in Linux I only know Ctrl-C).

Thanks,
A. N. Roy