Re: getCString a good idea here?
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.