Originally Posted by
AeonMoth
would somebody please, tell me a little about what these are... i have done the tutorial for it on the site, but i don't really know what its talking about... what are the arguments for and where does the input come from
You surely used functions with some arguments before, didn't you? so, let's say you have something like this:
Code:
void myFunc(int number, char ch);
Here you've got 2 arguments, number of type int and ch of type char. You use it within your program, to interact with functions.
Now let's see this:
Code:
int main(int argc, char *argv[])
{
...
return 0;
}
That's your program, right? You can also give your program some arguments, like any other function but you have to do that from the command line (in DOS-Box).
Your first parameter (argument) is of type int and it tells you how many arguments the user passed to the program (Attention, program name is included in this count). So when you type
argc = 2;
And ZuK has already written how to use argv. In these example the first argument is agrv[0] = "myprog.exe", the second argv[1] = "arg1" and so on ...