CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    How to obtain Relative path from Absolute path?

    Hi,

    How do I obtain the relative path (e.g. "..\..\Test.tmp" ) from the absolute path ( "C:\Test.tmp" ) with respect to a directory (e.g. C:\Temp2\Dir2 )? This should work irrespective of where the file Test.tmp is stored.
    Do you have any sample code which could help me do this?

    Any help would be greatly appreciated.

    Thanks and Regards,
    SN


  2. #2
    Join Date
    Mar 2004
    Posts
    50

    Re: How to obtain Relative path from Absolute path?

    PathRelativePathTo

  3. #3
    Join Date
    Sep 2001
    Location
    Québec, Canada
    Posts
    1,923

    Re: How to obtain Relative path from Absolute path?

    Not sure PathRelativePathTo is exactly the function you need, but you can see an example here:

    http://www.freevbcode.com/ShowCode.asp?ID=6137

    JeffB
    CodeGuru VB FAQ Visual Basic Frequently Asked Questions
    VB Code color Tool to color your VB code on CodeGuru
    Before you post Importants informations to know before posting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured