You can easily do all your typical system operations using C programming. This article will show
you how to restart from C programming console.
Just Compile and execute the following program.
This program calls the system function of "stdlib.h" which is used to execute shutdown.exe which is present in C:\windows\system32 in Windows XP,Windows 7. For more options take a look at this.
Instead of /r in program you can give various options.
For example /s to shut down ,/h to hibernate. Various options for windows 7:
To know more about the system() funtion, Click here.
As, always, Have a happy reading and Stay Awesome !
#include <stdio.h> #include <stdlib.h> main() { char Restart; printf("Do you want to restart your computer now (y/n)\n"); scanf("%c",&Restart); if (Restart== 'y' ||Restart == 'Y') system("C:\\windows\\System32\\shutdown /r"); //for windows 7 // system("C:\\windows\\System32\\shutdown -r"); for windows xp /* for ubuntu linux system("shutdown -"your option") */ return 0; }
This program calls the system function of "stdlib.h" which is used to execute shutdown.exe which is present in C:\windows\system32 in Windows XP,Windows 7. For more options take a look at this.
Instead of /r in program you can give various options.
For example /s to shut down ,/h to hibernate. Various options for windows 7:
To know more about the system() funtion, Click here.
As, always, Have a happy reading and Stay Awesome !
-------------------------------------------------------------------------------------------------
Follow our blog posts @ Follow. So that you won't miss any interesting post and also to be the first to know the answers to many interesting questions.
Follow us on our Facebook page @ Fre Blogg
Head over to my You Tube channel for some interesting tutorials @ You Tube
0 comments:
Post a Comment
Please Enter your comment here......