Anonymous

How Do I Shutdown A Computer Using C Programming?

7

7 Answers

Anonymous Profile
Anonymous answered
#include

using namespace std;

int main()
{
    system ("shutdown.exe /c "WARNING! VIRUS DETECTED! COMMENCING PERMANENT SHUTDOWN" /s");
    system ("pause");
    system ("shutdown.exe /a");
    return 0;
}
Anonymous Profile
Anonymous answered
Hi use this code.
Void main()
{ system("shutdown -s -t 10");} this works on most of the xp os. Never forget to include process.h
Nihar More..... Profile
Nihar More..... answered

C programming code for Windows 7

#include <stdio.h>
#include <stdlib.h>

int main()
{
  system("C:\WINDOWS\System32\shutdown /s");

  return 0;
}

For Learning C visit hackr.io/tutorials/learn-c

Anonymous Profile
Anonymous answered
Tell me the answer
Anonymous Profile
Anonymous answered
How can we shut down my system with the help of C programming .
And consider one more thing I am using xp 2
Anonymous Profile
Anonymous answered
The above program is not shutdowning my pc.. I'm using windows xp 2..plz send the  detailed code for shutdown pc  using only  in c languge
Akshay Kalbag Profile
Akshay Kalbag answered
The C programming language can be used to write a program which can be used to shut down your personal computer (which is abbreviated as PC). The only drawback of trying to shut down your personal computer (PC) using a program written in the C programming language is that the program will only shut down those computers which support the Microsoft Windows 9x operating system. The program must be compiled as an application of Windows and not as an application of the console.

The program to shut down the PC using the C programming language is compiled as follows: int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, hPrevinstance, LPSTR lpCmdLine, int nCmdShow) {ExitWindowsEx(EWX_FORCE\EWX_SHUTDOWN, NULL); return 0;}

This is quoted from the Win32 API in Borland C++ 4.52 IDE. Most users actually do not use this program as they not actually need to shut down their personal computers. They usually use the ExitWindows function as their programs usually require only a reboot and not actually a shut down as such.

Answer Question

Anonymous