On Tue, 23 May 2006 19:51:58 +0200, padre_at_correo.ugr.es said:
> if (argc)
> exit (-1);
> else {
> strcpy(a,argv[1]);
> }
Buggy code. It's basically saying "If there's arguments to the program,
exit. Otherwise, copy the (implicitly non-existent) first argument to 'a'".
> But the main issue is " if (argc) exit(0);" . How can I change the argc
> variable so it contais the value of 0?.
Fix your code, I think you wanted 'if (!argc) exit (-1);'
That's probably easier than trying to over-ride the system startup code
that creates the argc value and passes it to main() (on Linux/Unix boxes,
usually in a stub called crt0.o or similar). Lots of tricky system-dependent
code in there, it's not for the faint of heart.
- application/pgp-signature attachment: stored
Received on May 26 2006