Thread: Fixing paths

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    132

    Fixing paths

    I use GetMouleFileName to get my application's path name. The problem is that the directory returned in provided in single slashes, e.g C:\Test\Demo1\Debug\demo1.exe

    How can I convert the single to 2 slashes to the directory can be used from C++?
    I tried a run through the string using a for statement and I found all the slashes, char 92 in ASCII. ANy ideas how to take advantage of that? Thank you
    Y3K Network http://www.y3knetwork.com
    Bringing the software of the future on the net.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: Fixing paths

    Originally posted by aker_y3k
    I use GetMouleFileName to get my application's path name. The problem is that the directory returned in provided in single slashes, e.g C:\Test\Demo1\Debug\demo1.exe

    How can I convert the single to 2 slashes to the directory can be used from C++?
    I tried a run through the string using a for statement and I found all the slashes, char 92 in ASCII. ANy ideas how to take advantage of that? Thank you
    No need!

    You only need the double slashes in your actual source code (as the \ is the C laguages escape char)

    The return from GetMouleFileName is fine for passing to other apis or displaying

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    One solution assuming you wanted to concatenate a '\' after every single '\' is via a string object's concatenate function. You could always use C-type functions but then you would need to reorganized your array structure.

    Kuphryn

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    132
    Oh, thank you, I havent though of it that way.
    Anyway, cya!
    Y3K Network http://www.y3knetwork.com
    Bringing the software of the future on the net.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ignore paths???
    By gransken in forum C++ Programming
    Replies: 12
    Last Post: 11-29-2008, 05:30 AM
  2. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  3. Getting other mudule paths
    By geek@02 in forum Windows Programming
    Replies: 3
    Last Post: 04-05-2005, 01:38 AM
  4. Finding the number of different paths on a rectangular grid
    By joejoefla in forum C++ Programming
    Replies: 3
    Last Post: 03-14-2004, 02:13 PM
  5. Q: Recursion to find all paths of a maze
    By reti in forum C Programming
    Replies: 7
    Last Post: 11-26-2002, 09:28 AM