+ 1
How to add switches as in shutdown.exe -s -f
When I create a C++ program, I get an exe as binary file. I wish to enhance it with parameters like -s -f -r or -onboot etc.
1 Answer
+ 4
Change the signature of your main function to incorporate your program to take command line arguments like;
int main(int argc, char* argv[]) {...}
where argc is the count of command line arguments the user has input at the command line and argv is an array of pointers to the commands line arguments input.
Then you need to write the code to loop over the argv array an handle the command(s) input etc.