• 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: Converting NSArray of NSString elements into binary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Converting NSArray of NSString elements into binary? (From: "R.L. Grigg" <email@hidden>)
 >Re: Converting NSArray of NSString elements into binary? (From: Nick Zitzmann <email@hidden>)
 >Re: Converting NSArray of NSString elements into binary? (From: "R.L. Grigg" <email@hidden>)
 >Re: Converting NSArray of NSString elements into binary? (From: Scott F Bayes <email@hidden>)
 >Re: Converting NSArray of NSString elements into binary? (From: mmalc crawford <email@hidden>)

  • Prev by Date: NONE or NOT ANY in Core Data predicates
  • Next by Date: Re: NSImageView
  • Previous by thread: Re: Converting NSArray of NSString elements into binary?
  • Next by thread: Re: Converting NSArray of NSString elements into binary?
  • Index(es):
    • Date
    • Thread