About Me

My photo
India
Hey there, lovely people! I'm Hemant Menaria, and I'm passionate about programming. Having completed my MCA in 2011, I've delved into the world of coding with fervor. I believe in sharing knowledge, making complex concepts easy to grasp for everyone. JAVA, PHP, and ANDROID hold a special place in my heart, and I spend most of my time immersed in them. Currently, I'm deeply engaged in API/Webservice frameworks and crafting Hybrid mobile applications to enhance flexibility in the digital realm. If you ever find yourself stuck with a programming challenge, feel free to reach out to me at +91-8955499900 or drop me a line at hemantmenaria008@gmail.com. I'm always eager to help fellow enthusiasts navigate the intricacies of coding!

Friday, March 18, 2011

Set Timer to ShutDown Computer through 'C'

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,,,suposse
when 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");
}

  • 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.

1 comment:

  1. thanks for single line code...I was looking for it....its working...

    ReplyDelete