Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xnin

Simple Question.

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

hi What does the "int argc, char** argv" mean when they are uesd in the main function? For example:
void main ( int argc, char** argv )  
{
  glutInit            ( &argc, argv );

-
}

 
Then the address of argc is past on to the glutinit function with the "argv" pointer. Why do we have to do that? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Those are related to the command line arguments. Eg, "program.exe /d". It''s been awhile, but I believe argc is the number of parameters passed, and argv is a character array of the parameters. Check some C++ tuts for info on that.

Share this post


Link to post
Share on other sites
Yes that is correct. "argc" is the number of tokens specified on the command line. And "argv" is an array of char * to the tokens.

Using the example given by Nemesis2k2:

argc = 2
argv = {"program.exe", "/d"}

Since glut is C driven (I believe), you need to pass in pointers to objects instead of passing by reference (as you would in C++)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!