Jump to content
  • Advertisement
Sign in to follow this  
justin12343

Quick Question

This topic is 3080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Assuming C or C++, you would likely use the command-line interface for this (or so I would imagine).

In general, the entry point for a C or C++ program can receive an array of strings from the calling environment. Some of these strings will typically be any command-line arguments that were entered when the program was invoked. These arguments can be parsed and interpreted in any way you want (for example, you could look for the string '-opengl' and select an OpenGL backend if the string is present).

Command-line arguments can be entered when invoking a program from a console or terminal, or (typically) from an IDE for development purposes. For maximum usability, however, you'll usually want to expose such options through an application-specific user interface (IMO, at least).

Share this post


Link to post
Share on other sites
Quote:
Can you point me to a tutorial or a example for c++?
Just Google/search for 'c++ command line arguments'.

Share this post


Link to post
Share on other sites
I would recommend using a configuration file (ASCII text will do) to store all of the settings of the application (in "My Documents" folder of the specific user) and making it possible to over-ride the settings read from the configuration file with command-line arguments.

If you are looking for a library to help you with this, you could take a look at boost::program_options at http://www.boost.org/

Share this post


Link to post
Share on other sites
Yeah, command line options is the normal way...


int main(int argc, char *argv[])
{
int ctr;
for (ctr=0;ctr!=argc;++ctr)
printf("%d %s\n", ctr, argv[ctr]);
return 0;
}


If you've ever seen that, then you have what you need...

argc stores the argument count, argv is an array of points to strings (arguments).

Have fun :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!