main arguments?
peace
hi everubody !!
my question is simple :
wht's the difference between using :
int main() ( without arguments) or int main( int argc, char *argv[], char *env[] ) ( tht we use in linux)
??
thanks
[230 byte] By [
peace_comp] at [2007-11-11 10:30:39]

# 1 Re: main arguments?
The first form is the most common one and it means that you execute main from the command line without passing any parameter to it. For example, if you have an exe file called "cls", you execute it from the command shell/prompt like this:
cls
Some programs need parameters that are passed as command line arguments. For example, a copy command/program takes two filenames so you invoke it like this:
copy file1 file2
For this to work, the main program that's behind the copy command has to use command line arguments so that file1 and file2 are accessible inside main(). The envp argument contains a list of environment variables. You can read more about this topic here:http://www.dev-archive.com/dev-archive/LegacyLink/9481
Danny at 2007-11-11 20:58:43 >
