[futurebasic] Re: [FB] Coloured text

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

From: Brian S <fblistserve@...>
Date: Sat, 30 Apr 2011 17:33:12 -0700
On Apr 30, 2011, at 4:15 PM, Dan Baeckström wrote:

> How is BlockZero() used?


It is used to clear an area of memory. My reference was to a ControlFontStyleRec.
The first parameter is a pointer to the record and the second parameter is the size of the item in the first parameter

If the cfs variable is local to the function ( i.e. inside a local function or a global ):

local fn xxxxx
dim as ControlFontStyleRec  cfs

BlockZero( @cfs, sizeof( ControlFontStyleRec ) )

end fn

Obviously, if the cfs record is passed as a pointer to another function, the syntax would change accordingly: ( e.g. )

local fn SomeFun( cfs as ^ControlFontStyleRec )

BlockZero( #cfs, sizeof( ControlFontStyleRec ) )

end fn

which would be called as:   

dim as ControlFontStyleRec cfs
fn SomeFun( @cfs ) // clear my cfs record in the called SomeFun function

In the second case the caller’s cfs record is cleared by BlockZero

Brian S