please dont rip this site

Language Ccpp Cref Examples Command_line.c

/ ********************************************************************
 *
 * Purpose: Demonstrate getting parameters from the command line.
 * Author:  M J Leslie
 * Date:    27-Mar-94
 *
 ********************************************************************/

#include <stdio.h>

main(int argc, char *argv[])
{
  int count;

   /*  Main takes two variables 'argc' is the number of parms on the 
    *  command line and 'argv' is a pointer to each of the parameters.
    *
    *	int argc    -- integer number called 'argc'
    *	char *argv[] -- Character pointer array!
    */

  printf("%i parameters entered on the command line.\n", argc);

				/*
				 * progname		argc = 1
				 * progname parm1 parm2	argc = 3
				 */

				/* 
				 * We take 1 from argc because 
				 * the argv array starts at zero 
				 * an ends at argc -1
				 */

  for ( count = 0; count <= argc -1 ; count++)
  {
				/* printf expects a pointer 
				 * to the text 
				 */

    printf("parm %d is %s\n", count, argv[count]);
  }
}


file: /Techref/language/ccpp/cref/EXAMPLES/command_line.c, 0KB, , updated: 1997/4/21 09:52, local time: 2024/4/18 17:08,
TOP NEW HELP FIND: 
3.22.51.241:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.piclist.com/techref/language/ccpp/cref/EXAMPLES/command_line.c"> language ccpp cref EXAMPLES command_line</A>

Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .