Shutdown function or shell command

Hey All, does any one know if there is a C++ function or a command i can call from the shell that can shutdown/restart haiku or would i have to create a separate function in my application?

Thanks guys :slight_smile:

There was a topic that was talking about this and other things a month or so ago.

http://www.haiku-os.org/community/forum/why_cant_i_make_desktop_shutdown_icon

use:
shutdown

to turn off the computer. or

shutdown -r

to restart the computer

1 Like

Ok great, does Haiku support ‘system(“shutdown”)’ for example , I could pull that off in linux pretty snappy but im unsure about Haiku.

I don’t know what you mean by ‘system(“shutdown”)’ .

shutdown is a binary file in /boot/system/bin and can be used as any bin file can.

Remember i am trying to call a binary ( aka the shutdown) binary from C++ in my application so what would i need to use to invoke a system command from C++ is essentially what im asking.

Ok i figured it out thanks :slight_smile: Got the application to tell the OS to shutdown with

void MainWindow::shutdown()
{
system(“shutdown”);
}