• 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
Re: Converting NSString to char constant (answered)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting NSString to char constant (answered)


  • Subject: Re: Converting NSString to char constant (answered)
  • From: Clark Cox <email@hidden>
  • Date: Fri, 2 Jan 2004 22:37:32 -0500

On Jan 02, 2004, at 17:24, KLW wrote:

> Answered my own question:
> char cResult = (char)[resultasNSString characterAtIndex:0];
>
> Anyone have a better, smaller, faster way?

Don't cast the result of -characterAtIndex: to char unless you're
absolutely sure that it is in the ASCII range, otherwise, you'll be
getting back unpredictable values.

--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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: Converting NSString to char constant (answered)
      • From: KLW <email@hidden>
References: 
 >RE: Converting NSString to char constant (answered) (From: KLW <email@hidden>)

  • Prev by Date: Re: [NSPlaceholderDictionary initWithObjects:forKeys:]
  • Next by Date: Re: Good example code for an Inspector/Get Info window?
  • Previous by thread: RE: Converting NSString to char constant (answered)
  • Next by thread: Re: Converting NSString to char constant (answered)
  • Index(es):
    • Date
    • Thread