Really easy path question

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++.
ds1964Asked:
Who is Participating?
 
alexoConnect With a Mentor Commented:
GetModuleFilename()
0
 
thresher_sharkCommented:
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
 
warmcatCommented:
If you're working in Win32:

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

0
 
thresher_sharkCommented:
Yes, that function seems to do the trick.
0
 
ds1964Author Commented:
Perfect!! Thanks!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.