[futurebasic] Re: [FB] CFIndexRead using FSRef

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2008 : Group Archive : Group : All Groups

From: Steve <mactech@...>
Date: Fri, 25 Jan 2008 15:19:01 -0500
This works below :

not needed for FBtoC :array = fn CFIndexGetArray_priv( indexID )

#if def _FBtoC
local mode
local fn CFReadXML( indexID as CFIndex, sRef as @FSRef )

dim as CFMutableArrayRef     array
dim as CFDataRef           @ dataRef
dim as CFURLRef              url
dim as CFIndex count

url = fn CFURLCreateFromFSRef( 0, #sRef )

long if ( url )
long if ( fn CFURLCreateDataAndPropertiesFromResource( 0, url,  
@dataRef, #0, 0, #0 ) )
long if ( dataRef )
array = fn CFPropertyListCreateFromXMLData( 0, dataRef, 0, #0 )
long if ( array )
fn CFIndexSetArray_priv( indexID, array )
count =fn CFIndexGetCount (indexID)
end if
CFRelease( dataRef )
end if
end if
CFRelease( url )
end if

end fn
#endif

On Jan 25, 2008, at 3:06 PM, Steve wrote:

>
> On Jan 25, 2008, at 2:51 PM, Alain Pastor wrote:
>
>> Steve a écrit :
>>> Bernie,
>>> What do I replace in CFIndexRead to read the XML data using a  
>>> FSRef instead of a FSSpec ?
>>> I created fn CFReadXML shown below and it fails where marked in red.
>>> #if def _FBtoC
>>> local mode
>>> local fn CFReadXML( indexID as CFIndex, sRef as ^FSRef )
>>> '~'1
>>> dim as CFMutableArrayRef     array
>>> dim as CFDataRef           @ dataRef
>>> dim as CFURLRef              url
>>> dim as CFIndex count
>>> array = fn CFIndexGetArray_priv( indexID )
>>> long if ( array == 0 )
>>> url = fn CFURLCreateFromFSRef( 0, sRef )
>>>
>> Not sure, but the above line should read:
>>
>> url = fn CFURLCreateFromFSRef( 0, #sRef )
>>
>> No?
>
>
> Thanks,  that is now creating a URL reference.
>
> I am never sure when to use @ ^ # or nothing at all.
>