On 11 May '08, at 10:36 AM, Steve Cronin wrote:

const char * cPartNumber = [partNumber cStringUsingEncoding:NSUTF8StringEncoding];

That looks correct, assuming the Carbon function does take a C string in UTF-8 encoding, but you can make it a bit more compact:

        const char *  cPartNumber = [partNumber UTF8String];

                                        (char *) cPartNumber,

It would be a good idea to check whether that function takes a char* (instead of const char*) because it actually writes back into the string, or because someone just forgot to put a "const" in its declaration. Most likely it's the latter, but in the former case there's a chance it could blow up the heap if it decides to overwrite the C string generated by the NSString.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to