fast CString -> IO PackedString fuction

John Meacham john@repetae.net
Thu, 21 Aug 2003 03:10:04 -0700


On Wed, Aug 20, 2003 at 06:48:58PM -0700, Hal Daume wrote:
> is there a way to go from a CString to a PackedString w/o going through
> a normal String in the middle?
> or should i write my own?

If you can get a wchar_t * out of the app then that can be simply cast
to a packedstring, this is quite speedy.
if you use mbsrtowcs(3) and friends to do the conversion from char *
then you get properly localized text via locale settings for free :)
I have used this sort of thing for interfacing haskell to libraries
where honoring locale was important in the past. 
        John 

-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john@foo.net
---------------------------------------------------------------------------