C Program to Shutdown Computer in Linux

bookmark

/*
 * C Program to Shutdown or Turn Off the Computer in Linux.
 */
#include <stdio.h>
 
int main()
{
    system("shutdown -P now");
    return 0;
}

 

Output


shutdown: Need to be root