C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C

Can someone edit this code to compile code system to System Restart? And System to shut down with 0sec delay ? Pls help me out https://code.sololearn.com/csnw5DTRh8g6/?ref=app

18th Feb 2022, 10:38 AM
Ejeh Wayne
Ejeh Wayne - avatar
4 Answers
0
------------- #include<stdio.h> #include<conio.h> int main() { system("C:\\Windows\\System32\\shutdown /s /t 0"); return 0; } ---------- This will shutdown your computer in no time, you need to use the "conio.h" (Console Input Output) library and add a timer and set it to 0.
18th Feb 2022, 10:58 AM
Carbon
Carbon - avatar
0
Carbon what about to system to restart
18th Feb 2022, 11:08 AM
Ejeh Wayne
Ejeh Wayne - avatar
0
This takes me back 30 years! My first assembly program was called warmboot.
18th Feb 2022, 12:08 PM
HungryTradie
HungryTradie - avatar
0
I think "shutdown /r" gives a restart. It would be reasonable to assume that the folder \windows\system32 would be in the path, so you could probably omit it. MS often allowed /? to show a list of arguments for their DOS programs, I would assume that still works.
18th Feb 2022, 12:15 PM
HungryTradie
HungryTradie - avatar