Solved

Really easy path question

Posted on 1998-08-25
5
208 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 20 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
returning a dereferenced pts in C++ 10 158
best sources to up-to-date in C++? 8 89
operator overload: incompatible type and too many params 5 82
Outlook 13 41
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

808 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