From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Determining the path of the executable at runtime Date: Tue, 02 Sep 1997 18:08:26 -0400 Organization: Cornell University http://www.cornell.edu Lines: 21 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <340C8E59.C8A019DF@cornell.edu> References: <927cd$11e31 DOT 3dd AT news DOT eznet DOT net> Reply-To: asu1 AT cornell DOT edu NNTP-Posting-Host: cu-dialup-0019.cit.cornell.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Karl Garrison 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: compile and run the following program: #include int main(int argc, char* argv[]) { printf("%s\n", argv[0]); return 0; } i do not know how ansi it is to return the full path in addition to the name of the executable. -- Sinan