Mail Archives: djgpp/2002/01/09/14:00:22
X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f
|
Message-ID: | <3C3C84AF.90518DCD@yahoo.com>
|
From: | CBFalconer <cbfalconer AT yahoo DOT com>
|
Organization: | Ched Research
|
X-Mailer: | Mozilla 4.75 [en] (Win98; U)
|
X-Accept-Language: | en
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: command line argument
|
References: | <s2W_7.24353$KQ3 DOT 447543 AT news1 DOT oke DOT nextra DOT no>
|
Lines: | 59
|
Date: | Wed, 09 Jan 2002 18:47:30 GMT
|
NNTP-Posting-Host: | 12.90.181.44
|
X-Complaints-To: | abuse AT worldnet DOT att DOT net
|
X-Trace: | bgtnsc05-news.ops.worldnet.att.net 1010602050 12.90.181.44 (Wed, 09 Jan 2002 18:47:30 GMT)
|
NNTP-Posting-Date: | Wed, 09 Jan 2002 18:47:30 GMT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Drac0 wrote:
>
> /* could anyone tell me why this doesn't work? */
>
> #include <stdio.h>
>
> main(int argc, int * argv[])
> {
>
> if(* argv[1] >= 100)
> printf("argv is bigger or equal to 100!\n");
> else
> printf("argv is less than 100!\n");
> return 0;
> }
>
> /* I cant see why this shouldn't work! */
Compare with this, written about another query elsegroup:
c:\dnld\scratch>type junk.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
double d;
float f;
int i;
if (argc < 2) printf("Usage: %s %s\n",
argv[0],
" number number ...");
else {
for (i = 1; i < argc; i++) {
if (1 != sscanf(argv[i], "%lf", &d)) return EXIT_FAILURE;
f = d;
printf("%d: %25.20f, %15.10f %s\n",
i, d, (double)f, argv[i]);
}
}
return 0;
}
c:\dnld\scratch>gcc junk.c
c:\dnld\scratch>a 6.45 124.1
1: 6.45000000000000017764, 6.4499998093 6.45
2: 124.09999999999999431566, 124.0999984741 124.1
and note that main returns an int.
--
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
(Remove "XXXX" from reply address. yahoo works unmodified)
mailto:uce AT ftc DOT gov (for spambots to harvest)
- Raw text -