#include #include int main(int argc, char **argv) { FILE *f = fopen("/sys/power/state", "w"); if(f == NULL) { printf("%s is unable to write to /sys/power/state.\nAdd the setuid bit?\n", argv[0]); exit(1); } fprintf(f, "%s", argv[1]); fclose(f); }