469,327 Members | 1,347 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

Relative path

I got a relative path, eg."..\..\temp\documents"

Is there a function to convert that into full absolute path?
Feb 22 '07 #1
7 27769
I'm very new to C#, but I would think you can just make both paths
strings and add them together.
for example:
string a would = "c:\program files\"
string b would = "temp\documents\"
string c = string a + string b

Sorry for not using C# code, but I'm still learning and it was faster to
show my example as it is rather than look up the proper code. I wanted
to be sure I didn't give you false info if I used incorrect syntax, not
that yo uwouldn't have caught any errors I made.


*** Sent via Developersdex http://www.developersdex.com ***
Feb 22 '07 #2
Hi Alab,

This is how you can do that.

string fullpath = System.IO.Path.GetFullPath("..\..\temp\documents") ;

Alan T wrote:
I got a relative path, eg."..\..\temp\documents"

Is there a function to convert that into full absolute path?
Feb 22 '07 #3

Hi Alan,

This is how you can do this.

string fullpath = System.IO.Path.GetFullPath("..\..\temp\documents") ;

- karthik D V

Alan T wrote:
I got a relative path, eg."..\..\temp\documents"

Is there a function to convert that into full absolute path?
Feb 22 '07 #4
Thanks Karthik - I learned something too :)

*** Sent via Developersdex http://www.developersdex.com ***
Feb 22 '07 #5
Hi Ted,

Just wonder are you in Australia?

"Ted E." <an*******@devdex.comwrote in message
news:uD**************@TK2MSFTNGP03.phx.gbl...
Thanks Karthik - I learned something too :)

*** Sent via Developersdex http://www.developersdex.com ***

Feb 22 '07 #6
Thanks.

How about the other way around?
"C:\mydoc\employee\d1.doc" into the relative path?

"Karthik D V" <Ka************@gmail.comwrote in message
news:11**********************@l53g2000cwa.googlegr oups.com...
>
Hi Alan,

This is how you can do this.

string fullpath = System.IO.Path.GetFullPath("..\..\temp\documents") ;

- karthik D V

Alan T wrote:
>I got a relative path, eg."..\..\temp\documents"

Is there a function to convert that into full absolute path?

Feb 22 '07 #7
@ Alan T
>Hi Ted,
Just wonder are you in Australia?
No, I am not. I'm in the US and a bit embarrassed at how easy the
solution was LOL. Hey, I tried but I have a lot more to learn
(obviously):P

*** Sent via Developersdex http://www.developersdex.com ***
Feb 22 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Doug | last post: by
7 posts views Thread by Rizaan Jappie | last post: by
6 posts views Thread by openleren | last post: by
4 posts views Thread by Win, Pats | last post: by
18 posts views Thread by Nak | last post: by
8 posts views Thread by JJ | last post: by
15 posts views Thread by Lars Eighner | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.