Re: @Strings and strings in C
Re: @Strings and strings in C
- Subject: Re: @Strings and strings in C
- From: Prachi Gauriar <email@hidden>
- Date: Sun, 29 Jun 2003 14:20:59 -0500
On Sunday, June 29, 2003, at 09:59 AM, Jeff Harrell wrote:
On Sunday, June 29, 2003, at 07:33 AM, Sanri Parov wrote:
How can I transform a string to a byte string, in order to let it be
accepted by BerkeleyDB? To say, converting from @"Hello" to "Hello"?
const char* hello = [@"Hello" cString];
(It works for NSString objects of all sorts, even statically allocated
constants as you see here.)
It's worth noting that the cString method could be deprecated soon.
Here's what the docs say:
Use of this method is discouraged as it will be deprecated in the near
future. Instead it is recommended to use UTF8String to convert
arbitrary NSStrings to a lossless 8-bit representation.
Also, if UTF8String won't do it for you for some reason, you can use
lossyCString instead, which will convert the string to ASCII with a
possible loss of information.
-Prachi
_______________________________________________
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.