• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSString <--> MacRoman Pascal String
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: NSString <--> MacRoman Pascal String
      • From: Uli Kusterer <email@hidden>
    • Re: NSString <--> MacRoman Pascal String
      • From: "Clark S. Cox III" <email@hidden>
  • Prev by Date: Re: Future Objective-C changes
  • Next by Date: Re: [Q] How do I Create an NSEvent Using Runtime Functions?
  • Previous by thread: Re: [Q] How do I Create an NSEvent Using Runtime Functions?
  • Next by thread: Re: NSString <--> MacRoman Pascal String
  • Index(es):
    • Date
    • Thread