Application path

This is a discussion on Application path within the C++ Programming forums, part of the General Programming Boards category; Hi! How can I find full path to where my application is running/installed? In VB there is a function called ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    19

    Question Application path

    Hi!

    How can I find full path to where my application is running/installed? In VB there is a function called App.Path, App.ExeName and so forth. Is there a similar fuction in VC++ too?
    Regards!
    Ales Zigon

    Rock 'em key things!!

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    If you're creating a console app then -

    Code:
    int main(int argc, char* argv[])
    {
    	printf("%s\n",argv[0]);
    	return 0;
    }
    If it's a windows one then you can use GetCurrentDirectory() to get the path.
    zen

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    19
    Originally posted by zen
    If you're creating a console app then -

    Code:
    int main(int argc, char* argv[])
    {
    	printf("%s\n",argv[0]);
    	return 0;
    }
    If it's a windows one then you can use GetCurrentDirectory() to get the path.
    Hi!

    Thanx! So, it means that everything should be done via API.

    2B||!=2B this is the question (Hamlet rewritten in C)
    Regards!
    Ales Zigon

    Rock 'em key things!!

  4. #4
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    No, the first example doesn't use the API. As you stated you were using MSVC, I was giving you an alternative incase you were using WinMain() instread of main().
    zen

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    19
    Originally posted by zen
    No, the first example doesn't use the API. As you stated you were using MSVC, I was giving you an alternative incase you were using WinMain() instread of main().
    Oh, I see! Thanx again.

    2B||!=2B
    Regards!
    Ales Zigon

    Rock 'em key things!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. get application data folder path
    By skuallpa in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2009, 04:19 PM
  2. SearchPath Without Considering Application Path
    By mercury529 in forum Windows Programming
    Replies: 1
    Last Post: 01-09-2007, 07:56 PM
  3. Replies: 1
    Last Post: 03-02-2006, 01:01 AM
  4. how to obtain the absolute application path
    By jagerhans in forum Linux Programming
    Replies: 4
    Last Post: 12-23-2004, 05:48 PM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 03:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21