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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to