delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/28/19:41:40

From: Darren Noble <darren AT calderathin DOT com>
To: djgpp AT delorie DOT com
Subject: Re: Command line help
Date: Mon, 28 Jun 1999 17:41:17 -0600
X-Mailer: KMail [version 1.0.17]
References: <19990628180854 DOT 22728 DOT 00000973 AT ng-ch1 DOT aol DOT com>
MIME-Version: 1.0
Message-Id: <99062817433501.00590@dome.calderathin.com>
Reply-To: djgpp AT delorie DOT com

On Mon, 28 Jun 1999, you wrote:
> Why doesn't this work?
> 
> #include <iostream.h>
> 
> int main(int argc, char argv[])
> {
>     int loop;
>     for(loop = 0; loop < argc; loop++)
>     {
>         cout<<"argv["<<loop<<"]: "<<argv[loop]<<endl;
>     }
>     return 0;
> }
> 
> Thanks,
> Tom Beauchamp

#include <iostream.h>

 int main(int argc, char *argv[]) // you need to put a star net to argv[] (*)
 {
     int loop;
     for(loop = 0; loop < argc; loop++)
     {
         cout<<"argv["<<loop<<"]: "<<argv[loop]<<endl;
     }
     return 0;
 }

this will work you just need that one charicter

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019