0

I'd love to do a proper shutdown of the Pi from a program (written in C) so that the only thing left to do is pull the power plug. Is this possible?

3
  • 4
    Yes. What have you tried?
    – joan
    Commented Jan 15, 2021 at 11:24
  • your question is about linux, not about RPi
    – jsotola
    Commented Jan 16, 2021 at 0:05
  • I didn't even know where to start.
    – user120300
    Commented Jan 19, 2021 at 5:33

1 Answer 1

5

Call system():

#include <stdlib.h>
  ...
  system("sudo shutdown now");
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.