Jump to content
  • Advertisement
Sign in to follow this  
Gink

Associate help messages with programs?

This topic is 4822 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

How can you make your program print out a list of arguments, or text through the help or /? in command prompt?

Share this post


Link to post
Share on other sites
Advertisement
Look up argv and argc in msdn. The parameters to int main (). those contain the extra stuff on the command line.

Edit. Here you go.

CLICKY

Share this post


Link to post
Share on other sites
Thanks, but I was looking for how to associate it with help messages. Like when you type help on certain apps they pritn out available arguments. I guess /? is the standard now though?

Share this post


Link to post
Share on other sites
Quote:
Original post by Gink
Thanks, but I was looking for how to associate it with help messages. Like when you type help on certain apps they pritn out available arguments. I guess /? is the standard now though?
That's exactly what you are looking for.

Cehck if one of the arguments is /? or if there are none at all, then print out your help message to the console, and end the program

pseudo code
int main()
{
//check for condition to print help in argv
//print message
//return 0;

//otherwise, continue here normally


}

Share this post


Link to post
Share on other sites
When I said help messages, I meant if I typed this
help progName
it would display stuff about the program.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gink
When I said help messages, I meant if I typed this
help progName
it would display stuff about the program.


Doesn't that only work with standard command prompt commands? Each command is implemented as it's own program, like copy, move etc... And help prints the relevant information for each one on it's own, using the method I posted above.

Share this post


Link to post
Share on other sites
You can extend this example to test each parameter for being " /? " Its pretty simple and there are a few ways to do it.


int main(int argc, char argv*)
{
for (int i=0; i<argc; i++)
{
cout << argv; //Print out each parameter such as /? , -t , -demo etc..
//Spaces deliminate the parameters
}
return 0;
}

Share this post


Link to post
Share on other sites
dunno, i remember downloading some freeware app that responded to help programname, not sure how to do that tho, is that built into command prompt or the actual app?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!