On Tuesday 29 August 2006 01:01 pm, Chuck Guzis wrote:
How many ways are there of representing variable
length character strings?
And how many have you run into? Off the top of my head, I've seen--on the
MS-DOS/Windows platform the following: byte count+data, word count+data,
data terminated by 00, data terminated by 0a, data terminated by 0d, data
terminated by 1F, and probably a few others that don't occur to me right
off.
Well, in general you have two ways:
a) Externaly - aka Length terminated
Due some way you know how many symbols there are
b) Internaly - aka Stop marker
A special Symbol or set of symbols marks the end
All can be seen as records/structures with the two components.
Classic subcategories are
a1) Length before the string (structure with two elements)
a2) Length in a different place (e.g. some list, or a structure
with stringlength and pointer)
b1) A dedicated symbol after the last - e.g. x'00, '$', etc.
that does not is part of the information
b2) A modifier, like using 2^8 as an endmarker - eg. the last
symbol has this bit set (or not set)
You may form endless variations of these concepts - as many
as you got time on your hand, and belive me, the last 50 years
gave developers quite some time to invent the world over and over.
Gruss
H.
--
VCF Europa 8.0 am 28/29.April 2007 in Muenchen
http://www.vcfe.org/