This for people who want to know what to do with 'int main(int argc, char *argv[])', I'm open to suggustions or corrections.
THX
So here it is!
Code:
//////////////////////////////
// Karl's *ARGV[] Example
// argv.c
//////////////////////////////
//
// This program prints the
// command line.
//
// If you use DOS, compile this
// then type in 'argv', then run
// this program then you will see
// something like this:
//
// Command Line:
// C:\stuff\argv.exe
//
// If you use Windows, compile this
// then goto the start menu then
// goto 'programs' and click on
// 'MS-DOS Prompt', then type in:
// C:\stuff\argv
// Then you will see something like
// this:
//
// Command Line:
// C:\stuff\argv.exe
//
// The Comments though-out the
// program will explain more
// about how this works.
//
//////////////////////////////
#include <stdio.h> // Standard I/O
int main(int argc, char *argv[]) // *argv[] is a pointer that points to the strings on the command line
{
int ctr; // Counter Variable
printf("Command Line:\n");
for(ctr=0;ctr<argc;ctr++) // 'argc' is the number of strings on the command line
{
printf("%s\n", argv[ctr]);
}
getchar();
return 0;
}