How to write a shutdown program in C

How to write a shutdown program in C

We only need to use system to call the system command to realize the shutdown operation

refer to‮‬:lautturi.com
/*
Example:shutdown system  in C language
*/

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

int main(int argc, char const *argv[]) {

    system("shutdown -s -t 0"); // Windows
    system("shutdown now"); 	// Unix/Linux
}
Created Time:2017-08-29 10:26:30  Author:lautturi