That would depend upon OS. For example in windows the WinAPI function is ExitWindowsEx . In other systems its other. In DOS its quite simple as windows one and here an article on that. I dont know about any other.
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
You may use the system function!
That might work with *nix, but not MS-Windows.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
#include <dos.h>
system ("shutdown +a"); // to enable automatic shutdown
system ("shutdown -s -t 1"); //to shutdown in 1 second
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
I just find it suspicious whenever someone shows up and their first post is "how do I reboot". This just screams "kiddie pest" to me.
Just so you know, there is no "any OS" answer to this.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Generalization means Windows as he didn't mention a specific OS.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276