Solved

reference execuatable's  full path

Posted on 1998-01-07
3
223 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
  • 2
3 Comments
 

Author Comment

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

Accepted Solution

by:
jhance earned 30 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now