www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/16/05:25:08

Date: Wed, 16 Apr 1997 10:54:31 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Benjamin D Chambers <chambersb AT juno DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: .exe name?
In-Reply-To: <19970415.163210.4935.0.chambersb@juno.com>
Message-ID: <Pine.SUN.3.91.970416105359.15770F-100000@is>
MIME-Version: 1.0

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 -


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