get path of current application C++
-
How would I get the full path of where an application is saved and started from in a C++ application??:)
User
GetCurrentDirectory()
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா
-
How would I get the full path of where an application is saved and started from in a C++ application??:)
-
How would I get the full path of where an application is saved and started from in a C++ application??:)
Wheres this program when you run your project or when a program is running?
WhiteSky
-
User
GetCurrentDirectory()
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா
-
GetCurrentDirectory can be different many times, like depending on the parent process currentdirectory, or "Startin Folder" of a short cut or how setcurrentdirectory() etc
And why do you say this to me?
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா
-
And why do you say this to me?
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா
brahmma wrote:
And why do you say this to me?
You suggested to use GetCurrentDirectory() for retrieving the application path.
-
How would I get the full path of where an application is saved and started from in a C++ application??:)
I don't understand what means "path where application is saved". If what you need is the folder from where application was started, use GetModuleFileName(NULL) or GetCommandLine to retrieve the full exe path and then PathRemoveFileSpec to get only the path. GetCurrentDirectory can be altered during program execution (not to mention that the application itself can be configured to run in other directory than the directory where the application resides).
-
How would I get the full path of where an application is saved and started from in a C++ application??:)
To get complete path of the current application.... TCHAR szPath[MAX_PATH]; GetModuleFileName(AfxGetApp()->m_hInstance, szPath, MAX_PATH); Use CreateProcess() to start an application. :)
-
brahmma wrote:
And why do you say this to me?
You suggested to use GetCurrentDirectory() for retrieving the application path.
-
brahmma wrote:
The question itself is not very clear. See here[^] And so did I suggest GetCurrentDirectory().
Whichever way you interpret the question, your answer would not work. Do not expect to getaway after posting wrong answers in public forums.
brahmma wrote:
If you were *of any help* to the person who asked the question, go tell him what you know.
The right answer was already posted and voted see here [^] so i did not want to repeat the same answer.
-
brahmma wrote:
The question itself is not very clear. See here[^] And so did I suggest GetCurrentDirectory().
Whichever way you interpret the question, your answer would not work. Do not expect to getaway after posting wrong answers in public forums.
brahmma wrote:
If you were *of any help* to the person who asked the question, go tell him what you know.
The right answer was already posted and voted see here [^] so i did not want to repeat the same answer.
suhredayan® wrote:
Whichever way you interpret the question, your answer would not work.
Huh? GetCurrentDirectory() does return the current directory. I have not suggested anything wrong. GetCurrentDirectory or GetModuleFileName, or even something else; depending on the user's need he has to choose what he wants.
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா