?
Solved

Really easy path question

Posted on 1998-08-25
5
Medium Priority
?
213 Views
Last Modified: 2010-04-01
I need to know the path of my application, this is real easy in VB since it has the App.Path object/property. Is there anything like this in C++.
0
Comment
Question by:ds1964
5 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1171219
Hmm... I'm not sure of any functions that would let you do that.  You could always use the argv[0] variable and then search the computers hard drive for the executable using findfirst and findnext.

Why do you need to know the path of your program anyway?
0
 
LVL 11

Accepted Solution

by:
alexo earned 80 total points
ID: 1171220
GetModuleFilename()
0
 
LVL 2

Expert Comment

by:warmcat
ID: 1171221
If you're working in Win32:

{
   char sz[256];
   ::GetModuleFileName(NULL, sz, sizeof(sz));
}

0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1171222
Yes, that function seems to do the trick.
0
 

Author Comment

by:ds1964
ID: 1171223
Perfect!! Thanks!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

840 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