Re: [Dev-C++] How to get application directory?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-03-09 12:30:58
|
If the application was started with a path, you might retrieve it as the arg[0] parameter of main(). If not, you have to search the path for an application with the correct name. I don't think there is a standard function to perform this. If I'm wrong, I very much want to know the name of the function, since it would be useful :) On Linux, it is possible to heck in the /proc filesystem. There exists a symbolic link: /proc/<process_id>/exe -> /my/running/binary That will specify which binary that is running. It may also be accessed as: /proc/self/exe -> /my/running/binary to avoid the extra trouble of retrieving process id and dynamically create the path to the symbolic link. /Per W On Tue, 9 Mar 2004 sub...@ar... wrote: > What I actually wanted is the directory where the binary application is stored... > Anybody knows how to get it? > > Thanks again, > Josep > > ----- Original Nachricht ---- > Von: Per Westermark <pw...@ia...> > An: Kevin Wood <ke...@me...> > Datum: 09.03.2004 10:28 > Betreff: Re: [Dev-C++] How to get application directory? > > > The question was which directory the application is running in - not where > > the application binary is stored. > > > > /Per W > > > > On Tue, 9 Mar 2004, Kevin Wood wrote: > > > > > getcwd() returns the current working directory, which is not necessarily > > > the same as the directory in which the application resides. > > > > > > At 08:10 09/03/04, Per Westermark wrote: > > > >getcwd() or _getcwd(). > > > > > > > >/Per W > > > > > > > >On Tue, 9 Mar 2004, Josep Subirana wrote: > > > > > > > > > Hi, > > > > > > > > > > Do you know how to get the directory where your c++ application is > > running > > > > > in? > > > > > This should be a simple question for most experienced c++ > > programmers! > > > > > > > > > > Thanks, > > > > > > > > > > Josep > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: IBM Linux Tutorials > > > Free Linux tutorial presented by Daniel Robbins, President and CEO of > > > GenToo technologies. Learn everything from fundamentals to system > > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > > _______________________________________________ > > > Dev-cpp-users mailing list > > > Dev...@li... > > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IBM Linux Tutorials > > Free Linux tutorial presented by Daniel Robbins, President and CEO of > > GenToo technologies. Learn everything from fundamentals to system > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > > |