[futurebasic] Re: problem with INDEX$

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

From: Mars Saxman <marssaxman@...>
Date: Fri, 27 Feb 98 00:22:21 -0800
>However the code that I came up with 
>from your suggestion drops into MacsBug at the Blockmove line and MacsBug 
>says the appl passed a bad handle.

Here's the line that's killing you:

>        BLOCKMOVE @tempStr$ + 1, DataHndl& + offset&, lngth

There's a very subtle but important difference. The value of a handle is 
the address of a record in a private Memory Manager structure. The first 
4 bytes of that structure are the address of your data. So the line as 
you have it copies the contents of tempStr$ all over the memory manager's 
list of handles, which is a great way to crash your app in a big hurry.

Thus DataHndl& is _not_ the address of your data. You have to extract the 
address with Peek Long:  [DataHndl&].

To make the line work, change it like this:

        BLOCKMOVE @tempStr$ + 1, [DataHndl&] + offset&, lngth

-Mars