Determaining if a program is running
Okay, I know that Linux and Unix use *.pid files to determin the pid of a running program.
My question is, how would I code the creation (in c) of one of these files into my program.
The purpose of this is to check if another existance of my program in creation is running.
I know that it is possible to just create a file with some variable placed in it and go from there though, if the program is explicitly killed (ctrl C) then this file will remain existant and cause confusion amoungst those that are not aware of what is going on.
( I am aware of how to create and read files )
Any help would be good.