2
Reply

problem in checking status process PID in c.

rohit kumar

rohit kumar

Dec 28 2017 10:17 AM
1.3k
I wrote a small program in C.
 
But when i compile it on my pc it goes to " loop" and my pc crashed.
 
program :
 
#include <stdlib.h>
int main()
{
label:;
system("start sleep.exe ");
goto label;
return 0;
}
Solution required:
1) Check sleep.exe is runing or not in process task list of win7.
2)if not running then run sleep.exe.
3)else goto label: for further checking.
program may be something like this:
#include <stdlib.h>
int main()
{
label:;
IF process sleep.exe is runing then{goto label:}
system("start sleep.exe ");
goto label;
return 0;
}

Answers (2)