View Single Post
  #6 (permalink)  
Old January 16th, 2007, 08:33 AM
Geo121 Geo121 is offline
Friend of Wrox
 
Join Date: Jan 2006
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

Exactly!!!!

In order to do this you must create parameters for the main function

EX:

int main(int argc, char *argv[]) {
     char x = *argv[1];
     int a, b;
     a = atoi(argv[2]);
     b = atoi(argv[3]);
}

now ignore the atoi function if you don't know what it is. (Parsing function)

What the above shows is parameters that are used for the example I posted above

this can apply to anything.

The argv[] applies to what you type after your program in the console window

so if its the first parameter it will be argv[1]

now this may be slightly confusing if you don't understand pointers so if you have any more questions about it just ask.

~ Geo

~ Don't take life too seriously, you'll never get out alive!
Reply With Quote