Relative path

A

Alan T

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

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

Ted E.

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.
 
K

Karthik D V

Hi Alab,

This is how you can do that.

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

Karthik D V

Hi Alan,

This is how you can do this.

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

- karthik D V
 
A

Alan T

Thanks.

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

Ted E.

@ 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top