TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: VICTOR KEMP
from: ANTHONY TIBBS
date: 1998-01-05 10:28:00
subject: How do you read command line parameters?10:28:5901/05/98

VK> Well the subject says it all.
VK> Unless the end of it got truncated in which case it said:
VK> "How do you read command line parameters?"
Simple.  Declare main with an "int" and "char**" parameter, and use those:
int main (int argc,           /* Number of arguments on cmd line */
          char **argv)        /* Cmd line arguments              */
{
   if (argc > 1)        
   {
   int i;
      for (i=1; i < argc; i++)
         cout << "Cmdline argument " << i << ": " << argv[i] << endl;
   }
   else
      cout << "You didn't specify any cmdline arguments!" << endl;
   return 0;
}
      
--- PointEd 2.0
---------------
* Origin: The Tibbs' Point - Ottawa, Ontario, Canada (1:163/215.38)

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™.