I can use “shutdown” in terminal windows and let the system reboot,but when I use system(“shutdown -q”) in one c programme,It does’t work and can’t get return value,but in another programme it can work,why?
Did understand reason behind adding -q. You can directly use system(“shutdown”) in code. It will shutdown the system.
Xuyong,
Is your program running as root? You can’t do a shutdown unless you are a root user.
If your program is running as a root then it may be a path problem. So you might want to specify the exact path system("/bin/shutdown -q")
Tim
I have use system("/bin/shutdown -q"),but it doesn’t work,but in another programme it can work.
the problem have been solved by using sysmgr_reboot()