You can schedule shutdown in Windows or Linux using C program. We will see how to schedule a shutdown using a c program. To schedule a shutdown in Windows, we execute the Windows command shutdown /s /t sec (where sec is time delay before shutdown in seconds). In Linux, we execute the command shutdown -h +600. The c programs to schedule a shutdown in Windows and Linux are given separately.
Search This Blog
Showing posts with label computer. Show all posts
Showing posts with label computer. Show all posts
C Program to Shutdown Computer - How to Shutdown Computer Using C Code
Computer can be shutdown using c program. But the commands are different in Windows and Linux. The system() function in c can be used to execute system commands ( Windows command or Linux command ). To shutdown the computer using c program, we execute the appropriate shutdown command using the system() function.
C Program to Logoff or Signout From Windows
You can logoff (also called logout or sign out) from a windows computer using c program. This can be done by executing a command. You just have to execute the command shutdown /l which executes shutdown.exe with command line parameter /l to force logout from Windows. The system() function in c can be used to execute any system commands. Therefore, the following simple c program when executed, will logout you from Windows instantly.
#include<stdio.h>
void main()
{
system("shutdown /l");
}
Subscribe to:
Posts (Atom)