C Program to shutdown Windows 7
C Program to shutdown Windows 7
This program turns off i.e shutdown your computer system.
System function of stdlib.h
is used to run an executable file shutdown.exe which is present in C:\WINDOWS\system32
folder in Windows 7 and XP
#include<stdio.h>
#include<stdlib.h> // to use system() method
int main()
{
printf("\n\n\t\tEduguru Shutdown program in c\n\n\n");
char ch;
printf("Do you want to shutdown your pc now (y/n)?");
scanf("%c", &ch);
if(ch == 'y'|| ch == 'Y')
{ /*
/s is used to order the compiler
to shutdown the PC
*/
system("C:\\WINDOWS\\System32\\shutdown /s");
}
return 0;
}