|
-
February 1st, 2004, 07:54 AM
#1
Get .Exe folder path
Hello,
Is it possible to get the executables folder path at runtime? E.g. "C:\Documents and Settings\MyProgram.exe"
I need it so as to open a file that’s located in the same folder as the executable and I don’t want to be hard coding it in because if the program is run on a different computer then the path will be wrong.
Thanks in advance
-
February 1st, 2004, 08:26 AM
#2
I assume you are using Windows...thus, take a look at the following FAQ...
-
February 1st, 2004, 10:24 AM
#3
-
February 1st, 2004, 12:21 PM
#4
Re: Get .Exe folder path
Originally posted by Fergal21
Hello,
Is it possible to get the executables folder path at runtime? E.g. "C:\Documents and Settings\MyProgram.exe"
I need it so as to open a file that’s located in the same folder as the executable and I don’t want to be hard coding it in because if the program is run on a different computer then the path will be wrong.
Thanks in advance
If you are in windows, use GetModuleFileName(NULL, .....
-
February 2nd, 2004, 04:26 AM
#5
Originally posted by mwilliamson
Its in argv[0].
No, it's not. That's a common misconception. argv[0] contains the application name as it was used to invoke your app, which might or might not be the full path name.
All the buzzt
CornedBee
-
February 2nd, 2004, 04:41 AM
#6
Originally posted by CornedBee
No, it's not. That's a common misconception. argv[0] contains the application name as it was used to invoke your app, which might or might not be the full path name.
I agree with CornedBee. We can Invoke the application with out specifying the full path in the command prompt.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|