Hi Zing,
Looking from inside your program you could do the following :
fuser -fu </file/to/program/>
to find any running processes, accessing this file (program)
or
ps -ef | grep <name of program> | grep -v grep | awk '{ print $2}'
This is a possibility too, to find a running process. As you understand this will have to be translated into C. To be honest, I am not this far in Programming C, but it might get you a little closer to your solution.
Please don't use the term exe anymore. It sounds too much like .exe .An executable would be preferred
@yourservice
David