how can i write a program or application in c / c++ to set timer for my computer to shut down
sometimes you want to set timer for your pc after which it automatically shutdown,,,supossewhen you are copying files and you know it will be completed in 1 hours and you want to sleep
...here is where you can set your timer for 1 hr (60 min) after which it will automatically shutdown
your pc....
#inlcude "process.h>
void main(void)
{
system("shutdown -s -t 60");
}
#inlcude "process.h>
void main(void)
{
system("shutdown -s -t 60");
}
- Save the above .Let file name is shutdown.c and compile and execute the above program.
- Now close the turbo c compiler and open the directory in window you have saved the close.c ( default directory c:\tc\bin).
- Double click the its exe file(shutdown.exe). After 60 min your window will shutdown autometically.
thanks for single line code...I was looking for it....its working...
ReplyDelete