PDA

View Full Version : What are argcp and argv in Glutinit function?



Cytoplasm
08-27-2000, 01:31 AM
Well I don't code in C/C++ (assembly in fact)so I do not use "int main(int argc, char** argv)" and cannot use " glutInit (&argc, argv) ; "
Can smb explain me what they are, thanks!

Bob
08-27-2000, 06:39 AM
argv is a pointer to an array of nullterminated strings, and argc says how large this array is.

Ther are automatucally passed to you when you start you program and enter main(). argv[0] is a pointer to a string which holds the name of the executable file, including full path. argv[1] is the first argument you pass to you program when starting it, and so on.

Like this:

c:\test.exe hello world

Then argc=3
argv[0]="c:\test.exe"
argv[1]="hello"
argv[2]="world"

elizb
08-31-2000, 08:18 PM
Any information you need to pass to the program can be passed as a string on the command line as Bob illustrated above. But... you don't have to pass it anything. Just run your program as usual and it will work provided you have created a Win 32 Console Application in MS Visual C++ 6.0. Don't know about other compilers.