Is there a way I can read the command line arguments passed into a C++ wxWidgets application? If so, could you please provide an example of how to do so.
In plain C++, there is argc and argv. When you are building a wxWidgets application, you can access these using wxApp::argc, wxApp::argv[] or wxAppConsole::argc, wxAppConsole::argv[]. Note that wxApp is derived from wxAppConsole, so either works depending on if you have a console app or GUI app. See wxAppConsole
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit() {
// Access command line arguments with wxApp::argc, wxApp::argv[0], etc.
// ...
}
You may also be interested in wxCmdLineParser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With