Thread: can .exe find the path to a file?

  1. #1
    Unregistered
    Guest

    can .exe find the path to a file?

    I want to check the path to a file on a bunch of computers. I was going to use a c++ program to be run as they log into novell.

    The program would search for a particular file and save the path to a text file (i.e. c:\folder1\program.exe).

    I am very new to c++. Thanks in advance!

  2. #2
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    I haven't been exposed to anything in c++ that would do that...so, my first thought is, create a dos batch file that uses the dos search commands for the file. Save the end result into a variable in your program and batta bing batta boom you have the path, then ofstream fout (whatever.txt); and that's about all i can think of for now.
    PHP and XML
    Let's talk about SAX

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Two functions that come to mind are FindExecutable(), and FindFirstFile(). There are non-windows specific ways but there is no need to use them. I find that FindExecutable() is fantastic for finding the path of the directory that your executible is running from. It sounds like you want to use FindFirstFile()/FindNextFile() functions to do what you want.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Remember to call FindClose() when finished.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Unregistered
    Guest

    Smile

    Great! Thanks a lot guys!

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. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM