1. Make a call from your C code to the Operating System API for shutdown. Which API call, what permissions you need and what options you have depends on the Operating System.
2. Break out the books and learn to make ACPI BIOS calls, probably more assembler than C. This will do it fast and sure but you may corrupt your OS and will certianly loose any unsaved data if you go this way.
"The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)