Mail Archives: djgpp/1997/04/16/05:25:08
On Tue, 15 Apr 1997, Benjamin D Chambers wrote:
> How does a function, independant of the rest of the program, determine
> the name of the executable file running?
By looking at argv[0], of course:
extern int __crt0_argc;
extern char **__crt0_argv;
These are global variables defined in the startup code which hold the
values of `argc' and `argv' passed to your `main' function.
Note that this is *very* DJGPP-specific (I'm not sure it won't break
even in DJGPP v1.x).
- Raw text -