Restart Mac OS X shamelessly with a C ++ call?

How to restart Mac OS X using C ++ (not Objetive-C) without invoking any child processes? Do not care, is it really ungrateful.

system("reboot"); //Is not acceptable as it relies on invoking a process
0
source share
2 answers

I cannot understand why you do not want to create a new process, but if you really do not want it, then it execve("reboot",0,0)will start reboot, replacing the current process. You need to enable it <unistd.h>.

I guess this is available on Mac OS; It should be on all POSIX platforms.

UPDATE

, Mac OS reboot. reboot(RB_AUTOBOOT); , . . .

+3

JMP 0xFFFF0​​p >

: -)

0

All Articles