?
Solved

reference execuatable's  full path

Posted on 1998-01-07
3
Medium Priority
?
237 Views
Last Modified: 2010-04-10
This is an extension to the questions I asked previously.
I need to find out the full path of my executable written in VC.    argv[0] only shows what's typed at the command line, but not including the FULL path.

I tried to use FindExecutable function. Once I included 'shellapi.h".  compile errors are all refering to the shellapi.h.  But I didn't change anything to it.  Any other files I need to include before shellapi.h?

what's the best way to find out the full path of a excutable?  or if you can reference it like you do to the working directory, that'll be good.
0
Comment
Question by:closingcost
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:closingcost
ID: 1177725
Edited text of question
0
 
LVL 32

Accepted Solution

by:
jhance earned 120 total points
ID: 1177726
You should be able to find the full path from using the information that is available in argv[0].  Remember, there are three ways that the program got found initially.  Either the pathname specified in argv[0] is fully qualified (i.e. C:\x\y\z\file.exe) and it can be found directly.  It may be relative (i.e. ..\x\y\z\file.exe or x\y\z\file.exe) and it can be found by using the current working directory as a base.  Lastly, it may be found from the PATH environment variable which can be searched and the file located.  There is no "magic" way to get the full pathname, but using the above information you can find it the same way that the operating system does.
0
 

Author Comment

by:closingcost
ID: 1177727
OK
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question