Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Shutdown Computer Using C Program

Share on Tumblr

This Program will shut down or turn off your Computer. When you execute this program on your machine it will immediately shut down your computer.

In this tutorial, you will find the difference program in c programming language for different operating systems like Windows XP, Windows 7, and Ubuntu.

C Program to Shutdown Windows XP Computer

#include 
#include 
 
int main()
{
   char ch;
 
   printf("Do you want to shutdown your computer now (y/n)\n");
   scanf("%c", &ch);
 
   if (ch == 'y' || ch == 'Y')
      system("C:\\WINDOWS\\System32\\shutdown -s");
 
   return 0;
}

C Program to Shutdown Windows 7 Computer

#include 
#include 
 
int main()
{
   system("C:\\WINDOWS\\System32\\shutdown /s");
 
   return 0;
}

C Program to Shutdown Ubuntu Linux Computer

#include 
 
int main() {
  system("shutdown -P now");
  return 0;
} 

The post How to Shutdown Computer Using C Program appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

How to Shutdown Computer Using C Program

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×