[futurebasic] Re: [FB] CFStrings and Paths

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

From: Brian S <fblistserve@...>
Date: Tue, 28 Jun 2011 12:31:02 -0700
On Jun 28, 2011, at 9:46 AM, Ken Shmidheiser wrote:

> Long answer:


A Q&D version( and mostly both, so check it ):

beginCDeclaration
CFStringRef GetIt( CFStringRef s );
endC

beginCFunction
CFStringRef GetIt( CFStringRef s ) 
{ 
  NSString *outString = [(NSString *)s stringByExpandingTildeInPath];
  return ( (CFStringRef *)outString ); 
}  
endC

toolbox fn GetIt( CFStringRef s ) = CFStringRef

dim as CFStringRef result
dim as Boolean    ignore
dim as Str255     pString

result = fn GetIt( @"~/Desktop")
ignore = fn CFStringGetPascalString( result, @pString, 256, _kCFStringEncodingMacRoman )
CFRelease( result )
print pString

RunApplicationEventLoop()



Brian S