delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/03/01:19:56

From: pjfarley AT dorsai DOT org (Peter J. Farley III)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Determining the path of the executable at runtime
Date: Wed, 03 Sep 1997 01:36:59 GMT
Organization: None
Lines: 17
Message-ID: <340cbedb.1982230@snews.zippo.com>
References: <927cd$11e31 DOT 3dd AT news DOT eznet DOT net>
NNTP-Posting-Host: news.newsdawg.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Karl Garrison <karlos AT eznet DOT net> wrote:

>Does anyone know how I can find out what directory a program was invoked
>from?  I would perfer an ANSI-C method, but, failing that, a
>DJGPP-specific method would be acceptable.  Specifically:
>
>I am making a HTML editor that will look for configuration files and the
>like in the same directory as the executable.  I don't want to force the
>user to install in a particular directory, or make them add enviroment
>variables to their autoexec.bat.

I *think* that's what is in argv[0] when your main program starts.
I'm not sure the whole path is there, though.  Maybe just the "command
line" that started the program.

----------------------------------------------------
Peter J. Farley III (pjfarley AT dorsai DOT org)

- Raw text -


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