[futurebasic] Re: [FB] ascii text buffer to scrolling text field

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

From: Ken Shmidheiser <kshmidheiser@...>
Date: Tue, 18 May 2010 08:11:04 -0400
In this thread, Robert Purves wrote:

>There's no other method (except saving the buffer as a file and 
>reading TXN data from that).

Robert,

This is untested, but couldn't the buffer be read as CFData and 
converted to a CFStringRef then placed into the view?

Ken

CFDataRef   bufferData
CFStringRef bufferStr

bufferData = fn CFDataCreateWithBytesNoCopy( _kCFAllocatorDefault, 
buffer, sizeof(buffer), _kCFAllocatorNull )
bufferStr  = fn CFStringCreateFromExternalRepresentation( 
_kCFAllocatorDefault, bufferData, _kCFStringEncodingASCII )
CFRelease( bufferData )
HIViewSetText( txtView, bufferStr )
CFRelease( bufferStr )