At the beginning i wanted to point out the fact, that I'm a complete beginner with C and programming. I'm trying to make some simple console app to schedule delayed shutdown of my PC.
Here's my code:
int minutes, seconds;
printf("(s)hutdown or (a)bort?. 0 to exit.\n");
printf("How many minutes till shutdown\n");
seconds = minutes * 60;
sprintf(command, "shutdown /s /f /t %d\n", seconds);
sprintf(command, "shutdown /a");
The system function starts a new shell, so
will just exit from that new shell, returning execution control back to your program.
To kill the parent shell you can probably send it a SIGHUP signal.