[futurebasic] Re: [FB] containers

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2007 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Thu, 15 Feb 2007 11:23:56 -0700
On Feb 15, 2007, at 7:56 AM, Ted Spencer wrote:

> On 15 Feb, 2007, at 9:19 AM, AlStaff@... wrote:
>>> Is there a cute way of stepping through a container byte by byte,
>>> akin to the string$[i] thing?
>> You could use LEFT$$, MID$$, RIGHT$$
> Yes, thank you, but it's not "cute"... Under the hood, it probably  
> amounts to the same thing, though...
> Another handy thing about the string$[i] approach in my particular  
> app. is that it's particularly easy to fiddle with the length of  
> the string in the byte string$[0]; container$$'s length is most  
> unlikely to be in a handy byte. (Unless it's a new-age compressed  
> byte: you know: where 32 bits of useful information are embodied in  
> 8 bits.)
> This square bracket notation makes it fairly easy to insert and  
> delete characters in the string (and adjust the string length  
> accordingly), which is necessary here. This can be done readily in  
> a byte array (dim as byte container(32000)), but is there an  
> elegant way of getting that data into and out of an edit field  
> without going through a container$$?


Didn't see the original post, so I'm not sure of the goal and this  
could be off base.

  Are you aware that it is possible to dereference the handle to a  
container (a container is a runtime managed handle) and work on the  
contents a byte at a time (similar to the stream of char method for  
strings  [ ] ). Since the runtime manages the size, you would have to  
be knowledgeable if you change the container (compared to just using  
values in it).  Another possibility is to use an allocated handle or  
pointer instead of the container. This is a little more work but  
might give you what you want.

Brian S.