NSString <--> MacRoman Pascal String
NSString <--> MacRoman Pascal String
- Subject: NSString <--> MacRoman Pascal String
- From: Uli Kusterer <email@hidden>
- Date: Fri, 16 May 2003 19:33:39 +0200
Hi,
I have some data that is in MacRoman ("Mac ASCII") encoded Pascal
strings. To display and edit them, I need to get them into NSStrings,
to later write them out as Pascal Strings again. Sadly, I can't find
any NSString method that lets me decode it into a MacRoman string.
The NSString docs say that CFStringRef is interchangeable with
NSString everywhere, so I tried:
BOOL NSStringToStr255( NSString* strobj, StringPtr outStr )
{
if( [strobj length] < 256 )
{
Boolean result = false;
result = CFStringGetPascalString( (CFStringRef) strobj, outStr,
sizeof(outStr), kCFStringEncodingMacRoman );
return( result == true );
}
else
return NO;
}
But CFStringGetPascalString() always returns FALSE. Anybody know what
I'm doing wrong? Are there any alternative solutions I haven't found
yet? Thanks for any clues!
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.