Thread: [Dev-C++] How to get application directory?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Josep S. <sub...@ar...> - 2004-03-09 08:19:36
|
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 P.S. I have been able to run EMBEDDED MYSQL with Dev-C++ successfully. Now it links the libmysqld.a library + the programm successfully uses embedded mysql... If anyone is interested in running embedded mysql too, please let me know! |
|
From: Per W. <pw...@ia...> - 2004-03-09 08:27:08
|
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 > > P.S. I have been able to run EMBEDDED MYSQL with Dev-C++ successfully. Now > it links > the libmysqld.a library + the programm successfully uses embedded mysql... > If anyone > is interested in running embedded mysql too, please let me know! > > > > > ------------------------------------------------------- > 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 > |
|
From: Kevin W. <ke...@me...> - 2004-03-09 09:41:38
|
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 > > |
|
From: Per W. <pw...@ia...> - 2004-03-09 09:45:28
|
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 > |
|
From: P.D. v. Z. <pd...@xs...> - 2004-03-09 11:39:24
|
Is it by any chance possible to retrieve the directory where the binary is stored as well? I've managed to do this using the Win32 API, by getting the filename of the running module, and stripping the module name off, but I'd like to be able to do the same under Linux (I kind of need it, since my application needs to load some files that are in the same directory as the binary, and if the current working directory is not the directory the binary's stored in, it won't find those files, and my application will scream bloody murder) :) Sorry for jumping onto somebody else's question btw. Regards, Paul -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Per Westermark Sent: Tuesday, March 09, 2004 10:28 AM To: Kevin Wood Cc: DEV-C++ Subject: 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 |
|
From: <or...@vp...> - 2004-03-09 21:06:05
|
Josep Subirana wrote: > Do you know how to get the directory where your c++ application is runn= ing > in? > This should be a simple question for most experienced c++ programmers! __argv[0] has the entire path to your application binary. For example: "C:\Programs\MyProg.exe" All you need to do, is to strip off "MyProg.exe" (your app name). I suspect you wish to save config files, eh? :) (Well, at least that was why I needed to search for a solution a few=20 years ago, and that's what I found). One last note: I used __argv because if you have a WinMain in you=20 program, then you don't have argv simply. But __argv is always present=20 (as well as __argc), it is global, and has the same contents as argv and=20 argc would (at least in MinGW). -- Greetings, Bal=E1zs |