Startup path.

This is a discussion on Startup path. within the Windows Programming forums, part of the Platform Specific Boards category; Greetings. Google wouldn't find me an answear so I thought I'd ask you guys Using c++, i need to get ...

  1. #1
    Registered Viking
    Join Date
    Aug 2006
    Location
    Norway
    Posts
    19

    Startup path.

    Greetings.

    Google wouldn't find me an answear so I thought I'd ask you guys

    Using c++, i need to get the path my console app runs from.
    Now, I know a lot of you are thinking: just supply the filename relative to your executeable, and you're allright!

    E.g.
    Code:
    filename = "file.ext";
    However, I wouldn't be, because if you launch the program from another dir than the one containing the executeable (e.g. toolbar, shortcut etc.), the working directory would be incorrect. (At least it does in windows);
    Thusly, I require something like this:
    Code:
    filename = get_startup_path() + "\\filename.ext";
    So, if anyone has an answear I'd be very, very thankful.

    Regards,
    MisterT
    Last edited by MisterT; 12-26-2006 at 05:50 AM.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    argv[0] ?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Since you've posted on the Windows board GetModuleFileName might be of interest.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  4. #4
    Registered Viking
    Join Date
    Aug 2006
    Location
    Norway
    Posts
    19
    Thanks a lot!
    Sorry about posting in the Windows forum,
    I'm kinda new here..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Shortest Path Maze Solver (Breadth Search Help)
    By Raskalnikov in forum C Programming
    Replies: 5
    Last Post: 04-07-2009, 07:41 PM
  2. clipping path
    By stanlvw in forum Windows Programming
    Replies: 0
    Last Post: 07-23-2008, 11:47 PM
  3. Shortest path problem
    By Digitalxero in forum C++ Programming
    Replies: 0
    Last Post: 10-25-2005, 05:32 PM
  4. Path Finding Using Adjacency List.
    By DeepBlackMagic in forum C++ Programming
    Replies: 7
    Last Post: 05-16-2005, 02:34 PM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM

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