如何在c中检查状态过程PID

时间:2017-12-28 16:08:55

标签: c windows

我在C写了一个小程序。 但是当我在我的电脑上编译它时,它会进入"无限循环"我的电脑崩溃了。 程序:

#include <stdlib.h>

int main()
{
    label:;
    system("start sleep.exe ");
    goto label;
    return 0;
}

需要解决方案:

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.

程序可能是这样的:

#include <stdlib.h>

int main()
{
    label:;
    IF process sleep.exe is runing then{goto label:}
    system("start sleep.exe ");
    goto label;

    return 0;
}

0 个答案:

没有答案
相关问题