[futurebasic] Re: [FB] Comparing Records

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2001 : Group Archive : Group : All Groups

From: Ian Mann <i.mann@...>
Date: Thu, 05 Apr 2001 13:37:46 +0000
Herewith function to use to allocate strings to record strings so that record
comparison will work...

> begin record Nobbler
> dim Name as str63
> dim Address as str255
> dim NoseSize as long
> dim Height as short
> dim Cake as Byte
> dim Sandwich as byte
> end record
>
> dim RecTestA as Nobbler
> dim PassString as str255
>
> end globals
>
> clear local
> dim Count as Short
> dim a as str255
> local fn LookAtString (SPtr as pointer, NumBytes as short)
> dec (NumBytes)
> print "Size",peek(SPtr)
> for Count = 1 to NumBytes
> a = a +chr$(peek(SPtr+Count))
> next
> print a
> end fn
>
> local mode
> local fn PassStringToRec (FromPtr as pointer,ToPtr as pointer, sLength as
> short)
> def blockfill (ToPtr,sLength,48)' Blank Out Record String (and length byte)
> with zeros.
> dec(sLength)' Assume its from sizeof
> if peek(FromPtr) < sLength then sLength = peek(FromPtr)' Check so not
> overwriting
> blockmove FromPtr+1, ToPtr+1, sLength'Copy it
> poke ToPtr,sLength'Set Length
> end fn
>
> PassString = "Banana Daquiris on Toast"
>
> fn PassStringToRec (@PassString,@RecTestA.Name, sizeof(RecTestA.Name))
> fn LookAtString (@RecTestA.Name, sizeof(RecTestA.Name))
> print RecTestA.Name
>
> do
> handleevents
> until fn button

Regards to all

Old Grumpy