Thread: File Location - Please help

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    18

    File Location - Please help

    Hello.

    I am writing a program in MFC, and there are a few files included as dependencies in the installation. These files will be placed in the application folder on the target machine. The user can install this program anywhere they want on their computer. Inside the program, a path is needed to open up these default files, but if the user can install anywhere, how do I know the path? I have heard there is a function that gets the installation path of the program. I have searched for quite awhile, and I do not think i am getting close because I dont know how to phrase what Im looking for. If you have any suggestions, please let me know.

    Thanks,
    Khelder

  2. #2
    Registered User
    Join Date
    Dec 2003
    Posts
    18

    Naturally

    It seems posting on message boards is good look. 5 hours of searching...nada...post on message board..run across fix 5 minutes later. In case anyone was wondering, this gives the path to the location of the installation:

    CString Path(*__argv);

    Thanks anyways,

    Khelder

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    You can also use the GetModuleFileName() API function to return the path and name of the current module.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File being filled with NULLs
    By Tigers! in forum Windows Programming
    Replies: 2
    Last Post: 06-30-2009, 05:28 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  3. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM