#Why is my system function not working in executable file?
11 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
For starters, show your entire code (as text, not a screenshot)
They're hard to read and prevent copying and pasting.
#include <iostream>
#include <stdlib.h>
#include <windows.h>
#include <string>
using namespace std;
int main()
{
int a;
printf("Shuwdown time in (mins):");
cin >> a;
a = a * 60;
auto b = to_string(a);
system(("shutdown -s -t " + b).c_str());
}
```cpp
int main() {}
```
int main() {}
#include <iostream>
#include <stdlib.h>
#include <windows.h>
#include <string>
using namespace std;
int main()
{
int a;
printf("Shuwdown time in (mins):");
cin >> a;
a = a * 60;
auto b = to_string(a);
system(("shutdown -s -t " + b).c_str());
}
Did you run as admin?
yes I've tried running it with admin, does the same thing
You could try this condition test: https://www.geeksforgeeks.org/system-call-in-c/
Im not on windows.
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.