TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: VICTOR KEMP
from: KURT KUZBA
date: 1998-01-07 04:23:00
subject: How do you read command l

VK>   Well the subject says it all.
VK>   "How do you read command line parameters?"
   The command line arguments are passed as an array
   of pointers to arrays of type char.
#include 
int main(int argc, char *argv[])
{
   for(int argument = 0; argument < argc; argument++)
      puts(argv[argument]);
   return 0;
}
   In this case, argc will be the number of arguments on the
   command line, which must always be at least one, since the
   command to execute the program is the first argument.
   The argument will be found as a string called argv[0], which
   is the first string pointer in the argv array of pointers.
   The example code will print out each argument entered on the
   command line. You can analyze them and do whatever you want,
   according to what they are, within your code.
> ] Abandoning .. Perfect Truth .. I become .. My own Illusion..
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.