msdn parse command line
// Parsing_C_Commandline_args.c
// ARGS.C illustrates the following variables used for accessing
// command-line arguments and environment variables:
// argc argv envp
//
#include <stdio.h>
int main( int argc, // Number of strings in array argv
char *argv[], // Array of command-line argument strings
char **envp ) // Array of environment variable strings
{
int count;
// Display each command-line argument.
printf_s( "\nCommand-line arguments:\n" );
for( count = 0; count < argc; count++ )
printf_s( " argv[%d] %s\n", count, argv[count] );
// Display each environment variable.
printf_s( "\nEnvironment variables:\n" );
while( *envp != NULL )
printf_s( " %s\n", *(envp++) );
return;
}