How to shutdown pc by c code ?(win 7/8/10/xp)

How to shutdown pc by c code ?(win 7/8/10/xp)

Shortcuts:
 #include < stdio.h >
#include < stdlib.h >

int main()
{
system("C:\\WINDOWS\\System32\\shutdown /s");

return 0;

}

system function of stdlib.h is used to run an executable file shutdown.exe

Another Method:
 #include < stdio.h >
#include < stdlib.h >

int main()
{
system("shutdown /s");

return 0;
}

Correct way to do:


No comments