Please can anyone help me out of this problem?
I want to know that how can we reboot computer (any OS) using C language?

Recommended Answers

All 6 Replies

Member Avatar for GreenDay2001

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.

You may use the system function!

You may use the system function!

That might work with *nix, but not MS-Windows.

#include <dos.h>
system ("shutdown +a"); // to enable automatic shutdown
system ("shutdown -s -t 1"); //to shutdown in 1 second
commented: Oh you are right +18

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.

Generalization means Windows as he didn't mention a specific OS.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.