Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Really easy path question

Posted on 1998-08-25
5
Medium Priority
?
212 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
[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
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

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

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

636 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