rohit kumar

rohit kumar

  • NA
  • 6
  • 1.7k

problem in checking status process PID in c.

Dec 28 2017 10:17 AM
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)