Mail Archives: djgpp/1997/02/17/19:56:06
> Did you actually gave 2 arguments to your program? argv[0] is the
> program name, argv[1] is the first argument.
yep :) this code compiled fine under unix and linux, i was porting it you see.
i managed to find something that exhibits this behavior...
void main(int argc,char *argv[])
{
printf("%f but should be %s\n",atof(argv[1]),argv[1]);
}
save as test.c and compile gcc test.c -o test
now do test 8
it gives :
1.00000 should be 8
under linux and sunos it gives the correct value 8 however.
i eventually figured this one out, it can be solved by ensuring a #include
<stdlib.h> presumably linux and sunos were doing this automatically or
something. but it struck me as weird behavior nonetheless, after all it
compiled fine (ok -Wall would say implicit declaration, but you can do that
with printf in the example above and printf has the correct behavior?)
regards,
nik
>
> If the above doesn't give a clue, post the shortest program you can craft
> that exhibits this bug and the command line you pass it.
--
Graham Tootell
nikki AT gameboutique DOT com
- Raw text -