
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
C/C++ program to shutdown a system?
Here we will see how we can shut down the system by writing a simple C or C++ code. The shutdown process varies in different OS. If we are Linux user, we can use this terminal command to shut down.
shutdown –P now
If we are using Windows system, we can use this command −
c:\windows\system32\shutdown /i
We will see the code for Linux and Windows
Example(Linux)
#include<iostream> using namespace std; int main() { system("shutdown -P now"); }
Example(Windows)
#include<iostream> using namespace std; int main() { system("c:\windows\system32\shutdown /i "); }
- Related Articles
- Write program to shutdown a system in C/C++
- Hold shutdown function of the system using shutdown7
- C program to store inventory system using structures
- Write a C program of library management system using switch case
- System() Function in C/C++
- C++ Program to Add Two Distances (in inch-feet) System Using Structures
- C program to detect tokens in a C program
- C program to calculate range of values and an average cost of a personal system.
- JVM shutdown hook in Java
- Shutdown MongoDB with auth enabled?
- C/C++ program to make a simple calculator?
- Cardiovascular system is also known as(a) Digestive system(b) Excretory system(c) Circulatory system(d) Nervous system
- C++ Program to find size of int, float, double and char in Your System
- Amazing stuff with system() in C / C++?
- Connect to SAP system from C# application

Advertisements