shutting down a system using c

6 replies [Last post]
5ku11c4573r
Offline
Neophyte
Joined: 2011/10/20

guys i came across a c program while learning c... well thought of sharing with you guys.. Smile

void main(void)
{
system("shutdown -s");
}

save the program as CLOSE.c or anything.c , then compile it... when you run the program the system shuts down in 30 seconds... Smile

for restarting the system use '-r' instead of '-s' in the program.. Smile

to stop the countdown you have to follow the following steps:
1) go to run.
2) type 'shutdown -a' without quotations and then press enter.

you can also change the time by adding '-t' in the program...

void main(void)
{
system("shutdown -s -t 10");
}

now the system shutdowns in 10 seconds...

you can shutdown by following the steps in a different method..
1) on your desktop or any local drive press right click>new>shortcut.
2) in the shortcut box type in 'shutdown -s -t 30' without quotes and press next.
3) enter your desired name.
4) when you open the file it countdown starts.