Advertisement

Simple Question.

Started by March 05, 2003 11:57 PM
1 comment, last by Xnin 21 years, 11 months ago
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.
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.

Advertisement
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++)
---K-1 Productions: Come visit us here.

This topic is closed to new replies.

Advertisement