Thread: Path Determination

  1. #1
    AMAN GABA
    Guest

    Cool Path Determination

    I HAVE A SHELL PROGRAM WHICH IS RUNNING AS A SERVICE FROM SOME DRIVE "D:\SOMETHING_SOMETHING" .NOW WHEN I CREATE A FILE IT IS MADE INTO C:\WINNT\SYSTEM32 DIRECTORY . HOW CAN I DETERMING THE PATH OF THE EXECUTABLE SO THAT I COULD REFER THE PATH TO CREATE NEW FILE IN THE SAME DIRECTORY AS EXE

    REGARDS
    AMAN GABA

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    First, look at your keyboard. Learn to use the keys that have a
    little up and/or down arrows on it. They might also be labeled
    "shift".

    >SHELL PROGRAM

    ANSI:
    argv[0] stores the program name & path I think.

    VC++
    Look up the _pgmprt variable in the MSDN.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    I think the webmaster should add a quick snip of code to the board that checks for all CAPS, and if so, puts up Sunlight's best quote:

    "I'm sorry, but this board is case-sensitve. Please re-post in the proper fashion." or something along those lines...

  4. #4
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    I know that you can't write all caps, but, why is that?

    Oskilian

  5. #5
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    >I know that you can't write all caps, but, why is that?

    It's a very simple form of Netiquette that might even be
    in the faq. Boards and chats are text-only. So spelling
    a word in all caps is meant to stress this word. Spelling
    a whole sentence in caps is comparable to yelling in
    real life. Capitalizing a whole paragraph... well...
    I wouldn't talk to someone like that in real life.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  6. #6
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    You can use the GetModuleFileName() API function to get the path of your executable. Simply specify NULL for the first parameter and it will return the executables path.
    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. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Shortest Path Maze Solver (Breadth Search Help)
    By Raskalnikov in forum C Programming
    Replies: 5
    Last Post: 04-07-2009, 07:41 PM
  3. Can't figure out what keeps hanging up my program
    By shays in forum C Programming
    Replies: 7
    Last Post: 11-12-2007, 02:59 PM
  4. Shortest path problem
    By Digitalxero in forum C++ Programming
    Replies: 0
    Last Post: 10-25-2005, 05:32 PM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM