c program to Shutdown Restart Log off your Computer

This video tutorial explains how to write a c program to shutdown restart and log off your computer.
You will learn how to use system function in c program to execute shutdown command with arguments to shutdown restart and logoff your computer in detail with example.



Source code for this video tutorial

#include <stdio.h>
#include <stdlib.h>

int main()
{

   // system("c:\\windows\\system32\\shutdown /i");
   // system("c:\\windows\\system32\\shutdown /s");
    system("c:\\windows\\system32\\shutdown /r");
   // system("c:\\windows\\system32\\shutdown /l");

    return 0;
}