NAME
A function of omni::application
OVERLOADS
omni::application::set_args
A function of omni::application
#include <omni/application.hpp>void omni::application::set_args(int argc, const char** argv)OVERLOADS
void omni::application::set_args(int argc, const wchar_t** argv)
SYNOPSIS
Sets the command line arguments passed in to the underlying
top
Sets the command line arguments passed in to the underlying
omni::application::argparser instance.
top
DESCRIPTION
If you wish to retrieve the arguments passed to your application via the command line through the
top
If you wish to retrieve the arguments passed to your application via the command line through the
omni::application::args function, you will need to call this function passing in the argument count and a pointer to the argument array.
top
PARAMETERS
top
argc - The argument count passed in to the application. argv - A pointer to the array of char arguments passed to application via command line.
top
ERRORS
It is undefined behaviour if
top
It is undefined behaviour if
argc is less than the actual number of elements in the argument array.
top
CONSIDERATIONS
Care needs to be taken with argument handling as neither this function nor any functions in the
top
Care needs to be taken with argument handling as neither this function nor any functions in the
argparser class do any argument validation (i.e. user input validation).
top
EXAMPLE
Visit the examples page for more.
top
#include <omni/application> void app_run() { // get a reference omni::application::argparser& args = omni::application::args(); for (int i = 0; i < args.size(); ++i) { std::cout << "args[" << i << "]: " << args[i] << std::endl; } std::cout << "Leaving, waiting for CTRL+C" << std::endl; } int main(int argc, const char* argv[]) { omni::application::set_args(argc, argv); return omni::application::run(&app_run); }
top