Check if the process ID exists in C language

www.lautt‮moc.iru‬
Check if the process ID exists in C language
// C language example :Check if process exist in Linux 
#include <sys/stat.h>

int main(int argc, char *argv[]) {
	struct stat sts;
	if (stat("/proc/<pid>", &sts) == -1 && errno == ENOENT) {
	  // process doesn't exist
	}
return 0
}
Created Time:2017-08-28 10:01:29  Author:lautturi