468,505 Members | 1,655 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Backslash convention for path and file names

I guess there must be some convention or Windows specification for
whether the backslash immediately preceding the file name in a full
path string to a file is formally part of the path string or of the
file name. I suppose the options are:

1. Part of the path string, ie all returned path strings should have a
trailing backslash.

2. Part of the file name, ie all file names should start with a
backslash.

3. Neither, in which case one should presumably always expect to add a
backslash explicitly to the file name when building the full path
string to a file from its constituent path and file name.

Anyone enlighten me please as to what the preferred practice might be?

JGD
Jul 2 '06 #1
2 3007
John,
>3. Neither, in which case one should presumably always expect to add a
backslash explicitly to the file name when building the full path
string to a file from its constituent path and file name.

Anyone enlighten me please as to what the preferred practice might be?
Use the System.IO.Path class for building the path. That way, you
don't have to worry about it yourself.

Personally I see the backslash as a separator, and therefore it's not
really part of either side.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 2 '06 #2
"John Dann" <ne**@prodata.co.ukschrieb:
3. Neither, in which case one should presumably always expect to add a
backslash explicitly to the file name when building the full path
string to a file from its constituent path and file name.
Simply use 'System.IO.Path.Combine'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jul 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Aloysio Figueiredo | last post: by
2 posts views Thread by Fred | last post: by
22 posts views Thread by Generic Usenet Account | last post: by
34 posts views Thread by Reinhold Birkenfeld | last post: by
reply views Thread by Carl Colijn | last post: by
6 posts views Thread by John Salerno | last post: by
19 posts views Thread by Alan J. Flavell | last post: by
3 posts views Thread by Stef Mientki | last post: by
3 posts views Thread by placid | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.