Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,380 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,538 people online right now. Registration is fast and FREE... Join Now!




shutdown command

 
Reply to this topicStart new topic

shutdown command, code 2 shut down a windows XP

KSI ulgy mom
7 Feb, 2008 - 05:15 AM
Post #1

gonzo
**

Joined: 29 Jan, 2008
Posts: 110


Expert In: annoying

My Contributions
hay im making a program with my friend and we want a code line that shuts the computerat the end of the program. could u all help me? thanks ph34r.gif
User is offlineProfile CardPM
+Quote Post

MorphiusFaydal
RE: Shutdown Command
7 Feb, 2008 - 05:50 AM
Post #2

D.I.C Lover
Group Icon

Joined: 12 May, 2005
Posts: 1,212



Thanked: 15 times
Expert In: Hardware, Networking

My Contributions
http://www.cplusplus.com/reference/clibrar...lib/system.html
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Shutdown Command
7 Feb, 2008 - 07:15 AM
Post #3

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 7,113



Thanked: 76 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
Since it's a windows system...

CODE

#include <stdio.h>

int main(void) {

  system("shutdown");

  return 0;
}


Also check out:
http://msdn2.microsoft.com/en-us/library/a...885(VS.85).aspx & shutdown /?
User is offlineProfile CardPM
+Quote Post

KSI ulgy mom
RE: Shutdown Command
7 Feb, 2008 - 08:52 AM
Post #4

gonzo
**

Joined: 29 Jan, 2008
Posts: 110


Expert In: annoying

My Contributions
QUOTE(no2pencil @ 7 Feb, 2008 - 08:15 AM) *

Since it's a windows system...

CODE

#include <stdio.h>

int main(void) {

  system("shutdown");

  return 0;
}


Also check out:
http://msdn2.microsoft.com/en-us/library/a...885(VS.85).aspx & shutdown /?


it will not let me compile the program.

User is offlineProfile CardPM
+Quote Post

no2pencil
RE: Shutdown Command
7 Feb, 2008 - 09:22 AM
Post #5

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 7,113



Thanked: 76 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(KSI ulgy mom @ 7 Feb, 2008 - 09:52 AM) *

QUOTE(no2pencil @ 7 Feb, 2008 - 08:15 AM) *

Since it's a windows system...

CODE

#include <stdio.h>

int main(void) {

  system("shutdown");

  return 0;
}


Also check out:
http://msdn2.microsoft.com/en-us/library/a...885(VS.85).aspx & shutdown /?


Sorry... I was trying to find the header that is required by system, but I ran out of time. Maybe it's windows.h?

it will not let me compile the program.


User is offlineProfile CardPM
+Quote Post

TheMagnitude
RE: Shutdown Command
7 Feb, 2008 - 10:14 AM
Post #6

D.I.C Head
Group Icon

Joined: 12 Jan, 2008
Posts: 88



Thanked: 1 times
Dream Kudos: 125
My Contributions
Alternately you could make the program create a text file and save it as a filename.bat which contains:
CODE
shutdown -s

And execute that from the program. The other way is better this is just a different method if you wanted.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 09:26AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month