Re: to get handle to "File/1.jpg"
Re: to get handle to "File/1.jpg"
- Subject: Re: to get handle to "File/1.jpg"
- From: James Montgomerie <email@hidden>
- Date: Wed, 26 Nov 2008 15:19:31 +0000
On 26 Nov 2008, at 14:56, Nick Rogers wrote:
Hi,
How do I obtain a NSFileHandle to this file which has a forward
slash in the name to be able to write to this file.
Supplying the path to NSFileHandle with filename in quotes also fails.
If not possible is there any other way to write to such a file.
I can't use open(), as the file name could contain chars from other
language.
This file is only presented as having a '/' in the Finder UI (and
hopefully other places that present filenames on-screen). At the
filesystem level, that '/' is really a ':' (to avoid clashing with the
'/' directory seperator character). Just replace the '/' with a ':'
and you'll be set.
As an aside, there's no reason you can't use open with files that have
non-ASCII characters in their filenames. All the BSD-level filesystem
APIs accept UTF-8. If you have an NSString containing the non-ASCII
filename, you can just call '[myString fileSystemRepresentation]' to
get an appropriate char * for use with the BSD level APIs (you'll
still need to replace your '/'s with ':'s first though).
Jamie,
_______________________________________________
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