• 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: NSString pedantic question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString pedantic question


  • Subject: Re: NSString pedantic question
  • From: Aki Inoue <email@hidden>
  • Date: Wed, 28 Mar 2007 16:57:28 -0700

Look at -[NSFileManager stringWithFileSystemRepresentation:length:].
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html#//apple_ref/occ/instm/NSFileManager/stringWithFileSystemRepresentation:length: >


Aki

I am writing code that deals with NSStrings and paths.

I know that, to turn an NSString into a proper path, the best API to use is [myString fileSystemRepresentation]. You can also use [myString UTF8String] and it seems to work fine, but everyone says that the best, future-proof method is -fileSystemRepresentation, so we use it without question.

But what about going in reverse―if you've got a file system representation in a char array, there doesn't seem to be a [NSString stringWithFileSystemRepresentation:myCharPtr] API to load it back into an NSString. I've been using [NSString stringWithUTF8String:myCharPtr], which works fine, but it doesn't feel all nice and symmetric like it should. If that hypothetical future came to pass where the file system representation was no longer UTF8, I'd have to revamp this code. I don't expect that this will ever be an issue in practice, but I still feel like I'm missing something.

Any thoughts?_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >NSString pedantic question (From: John Stiles <email@hidden>)

  • Prev by Date: Re: NSString pedantic question
  • Next by Date: NSImage question
  • Previous by thread: Re: NSString pedantic question
  • Next by thread: NSImage question
  • Index(es):
    • Date
    • Thread