Re: Converting NSArray of NSString elements into binary?
Re: Converting NSArray of NSString elements into binary?
- Subject: Re: Converting NSArray of NSString elements into binary?
- From: John Stiles <email@hidden>
- Date: Mon, 1 Oct 2007 21:08:19 -0700
Surprisingly, mmalc did not list the API you should use with fread or
other POSIX-based APIs.
Just for the record, it's -fileSystemRepresentation.
In a pinch, UTF8String also works, but it's not recommended (in some
corner cases the result is slightly different, but POSIX compensates
for that anyway so it's not a big issue for practical use).
On Oct 1, 2007, at 8:39 PM, mmalc crawford wrote:
On Oct 1, 2007, at 7:27 PM, Scott F Bayes wrote:
At the risk of summary ostracization by the list,
[...]
[fileName getCString:fname];
Well, here's the summary ostracism:
*Do not use getCString.*
It's deprecated. See <http://developer.apple.com/documentation/
Cocoa/Reference/Foundation/Classes/NSString_Class/
DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/
instm/NSString/getCString:>.
If you want to retrieve the characters, specify an encoding or use
getCharacters:.
In the current context, dataUsingEncoding: looks like it may meet
the OP's needs.
Although it's still not clear exactly what use will be made of the
data in the end...
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden