How to get Exe's path directory

How can I get the directory name of where my MFC app
is located?

so if i run
c:\apps\myapp\myapp.exe

I want to be able to get c:\apps\myapp\ during runtime.
thanks
vinny5Asked:
Who is Participating?
 
jamovilleConnect With a Mentor Commented:
If you use the function GetCommandLine() in your application, it will return the path of the current process.  In other words it will return c:\apps\myapp\myapp.exe.
You can then parse the myapp.exe off of the string and return the remaining:  c:\apps\myapp value you are looking for.
0
 
vinny5Author Commented:
thanks.. it works.
0
All Courses

From novice to tech pro — start learning today.