Solved

How to get Exe's path directory

Posted on 1998-12-02
2
322 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:vinny5
[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
2 Comments
 
LVL 5

Accepted Solution

by:
jamoville earned 30 total points
ID: 1325664
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
 

Author Comment

by:vinny5
ID: 1325665
thanks.. it works.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

628 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