Mail Archives: djgpp/1999/06/28/19:33:52
This is a multi-part message in MIME format.
--------------B8D4111C56F04286DBD78162
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
FixAllPCs wrote:
>
> Could someone show me an example of command line parameters, please. I'm
> working on a project that would have input like:
>
> program_name parameter1 parameter2 parameter3
>
> That sort of thing.
>
> Thanks,
> Tom Beauchamp
--------------B8D4111C56F04286DBD78162
Content-Type: text/plain; charset=us-ascii;
name="ex1.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ex1.c"
#include <stdio.h>
void main(int argc, char *argv[])
{
int i=0;
for(i=0;i<=argc;i++)
printf("This is arg 1, %s.", argv[i]);
// argc is the amount of arguments
// argv is an array of strings that contains the args.
// element 0 is the path, 1-argc is the arguments.
} // end of main
--------------B8D4111C56F04286DBD78162--
- Raw text -