Thread: Getting current path?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    63
    If it is run from the command line it will just output the filename like "program.exe".

    However if the file is double clicked, then argv[0] will hold the current path aswell as the program name.

  2. #2
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by John_
    However if the file is double clicked, then argv[0] will hold the current path aswell as the program name.
    In this case it will hold the full path to the exe. But that need not be the current working directory.
    You have to call somthing like GetCurrentDirectory() to find out the current working directory.
    Even if you call your exe from the commandline. You could call the exe from anywhere ( somwhere other then where the exe is located ) and your OS would locate the exe via the PATH environment variable.
    Kurt

  3. #3
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Ah, thank you very much!
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Immediate programming help! Please!
    By xMEGANx in forum C++ Programming
    Replies: 6
    Last Post: 02-20-2008, 12:52 PM
  2. Problem with simple case statements
    By shoobsie in forum C Programming
    Replies: 2
    Last Post: 05-08-2006, 08:39 AM
  3. How to find the current path?
    By cloudy in forum C++ Programming
    Replies: 1
    Last Post: 04-25-2006, 11:05 AM
  4. compiler build error
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-30-2003, 10:16 AM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM