473,320 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Path Separator

Hi all,

If i have (for example) a directory structure, where the names can have
ANY character in them, what would be the best method for finding a
'unique series of characters' to use as a separator?

For instance, the structure could look like this:

!"£$%^&*()_+1234567890-
QWERTYUIOP{}qwertyuiop[]
ASDFGHJKL:@~asdfghjkl;'#
|ZXCVBNM<>?\zxcvbnm,./`¬

then im stuck for using a single character (lets pretend that all the
extended characters have been used aswell - it could happen, and most
likely will if i dont prepare for it), so i have to use two characters
for the separator. But of course, all the two character combinations
could have been used (yes, that's 65536 characters - but it's
possible).

So, how would YOU do it :-)

Cheers,
James.

Jul 19 '06 #1
2 2033
If i have (for example) a directory structure, where the names can have
ANY character in them, what would be the best method for finding a
'unique series of characters' to use as a separator?
I am going to use ASCII terminology because that is what I used when
designing protocols.

to mark the beginning and en of a protocol sequence I use combinations of 2
characters:
DLE-STX ->start of sequence
DLE-ETX-end of sequence.

the DLE is used as an escape character that indicates that the next char has
a special meaning.

of course, DLE can also be a character within the protocol sequence.
to prevent mis-interpretations, any time there is a DLE in the sequence
itself, it is transmitted twice.
so if the target receives 2 consecutive DLE characters, it knows that there
was just a single DLE
that was just a data character instead of an escape character.

You could easily do something similar for path separation.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jul 19 '06 #2
Bruno,
Case closed! Thankyou very much.

James.

Bruno van Dooren [MVP VC++] wrote:
If i have (for example) a directory structure, where the names can have
ANY character in them, what would be the best method for finding a
'unique series of characters' to use as a separator?

I am going to use ASCII terminology because that is what I used when
designing protocols.

to mark the beginning and en of a protocol sequence I use combinations of 2
characters:
DLE-STX ->start of sequence
DLE-ETX-end of sequence.

the DLE is used as an escape character that indicates that the next char has
a special meaning.

of course, DLE can also be a character within the protocol sequence.
to prevent mis-interpretations, any time there is a DLE in the sequence
itself, it is transmitted twice.
so if the target receives 2 consecutive DLE characters, it knows that there
was just a single DLE
that was just a data character instead of an escape character.

You could easily do something similar for path separation.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jul 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Coder Droid | last post by:
After much searching, I can't seem to find any definitive way to determine which path separator to use. Obviously, it's ":" on nix, and ";" on windows ... so what's the best way to determine what...
4
by: Hal Vaughan | last post by:
I want to have a config file for my program, which means I need to know where the config file is. If I type: java myclass and it runs myclass.class, is there any way to obtain the location of...
30
by: Stephen Ferg | last post by:
I have a question that is not directly Python-related. But I thought I'd ask the most erudite group that I know... :-) When did Windows start accepting the forward slash as a path separator...
11
by: could ildg | last post by:
I want to import c:\xxx\yyy\zzz.py into my programme, What should I do? Thank you~
13
by: André Nogueira | last post by:
Hi there. I know you can view a node's fullpath property, but is it posible to select a node using its path? Like, tell the treeview that the node that should be selected is the node with the...
9
by: Giampaolo Rodola' | last post by:
Hi, I'm trying to solve a jython-related issue and I discovered a different behavior affecting os.path.isabs between CPython and Jython. C:\Python23>python.exe Python 2.3.5 (#62, Feb 8 2005,...
8
by: andyau | last post by:
I am uploading a file to the server and at the same time I want to place the file name in to a database. But for the the file to be effective I need to trim the path from the filename and leave...
8
by: eliben | last post by:
Hello, os.path.split returns the head and tail of a path, but what if I want to have all the components ? I could not find a portable way to do this in the standard library, so I've concocted...
18
by: Aaron Gray | last post by:
Has anyone got a code snippet to separate out the path components, ie drive, path, filename, and extension ? Many thanks in advance, Aaron
2
by: mathieu | last post by:
Hi there, I do not understand what is going on with the following cmd line (*). As specified I would like to compile the cs file: C:/cygwin/home/mmalaterre/Projects/gdcm/trunk/Examples/Csharp/...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.