• 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: getCString a good idea here?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getCString a good idea here?


  • Subject: Re: getCString a good idea here?
  • From: Sherm Pendley <email@hidden>
  • Date: Sun, 13 Jul 2003 06:39:25 -0400

On Sunday, July 13, 2003, at 04:32 AM, Neil Earnshaw wrote:

The documentation says that -(void)getCString:(char*)buffer _takes_ a reference and puts a _copy_ of the chars in the area pointed to, rather than returning a reference. Is this the usual convention for get<Something> accessors?

No, but -getCString: is not an accessor method in the usual sense. Internally, NSString stores its data in a Unicode format - probably as an array of Unichars. This method returns a copy of that data that's been converted to the default encoding for your current locale.

Wouldn't the '&' mean you are supplying the address of a pointer to a char, i.e. a char**?

Don't forget, you have to provide the space for the chars to go into.Something like,

Quite right.

sherm--

A well-written program is its own heaven; a poorly-written program is its own hell.

-- The Tao of Programming
_______________________________________________
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.

References: 
 >Re: getCString a good idea here? (From: Neil Earnshaw <email@hidden>)

  • Prev by Date: Re: How to construct Unicode Safe Strings in the source?
  • Next by Date: Bug in Xcode, File Inspector lies to me.. (was: Re: How to construct Unicode Safe Strings in the source?)
  • Previous by thread: Re: getCString a good idea here?
  • Next by thread: Re: getCString a good idea here?
  • Index(es):
    • Date
    • Thread