[futurebasic] Re: [FB] Edit Fields, Strings

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: tedd <tedd@...>
Date: Wed, 26 May 1999 10:25:04 -0400
Sean -G3-:

>I don't work much with memory-related stuff, I ususually just let FB
>handle it for me.

Well... if you know how to define a string (i.e., DIM string$), then you
know a little bit about doing memory stuff.

A string is nothing more than a place in memory that contains a string of
characters. The only limitation is that it can not contain more than 255
characters. This limitation is due to the fact that the first byte in the
string is reserved for its length. As you know, the maximum length of a
string is 255. What you may not realize is that 255 in DEC is FF in HEX --
hence the limitation. If the string was longer, then the length could not
be represented by a single byte (i.e., 256 DEC would be 100 HEX which is
larger than one byte).

Now, when we are making long strings, we are simply grabbing memory and
using it as we want -- while keeping the first _two_ bytes reserved for the
length of our long string.

You may want to try doing this a little at a time to understand the
concept. I'll help explain, but I need to know how much you know -- So,
here's the first question - If we limit our long strings to a two byte
length representation (instead of one as found in normal string) then
what's the maximum length of our new long strings?

tedd

___________________________________________________________________
<mailto:tedd@...>	               http://sperling.com/