• 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
Converting file names to C strings (was Re: writing huge C-array to a file)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Converting file names to C strings (was Re: writing huge C-array to a file)


  • Subject: Converting file names to C strings (was Re: writing huge C-array to a file)
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 21 Jul 2006 08:54:11 -0700


On Jul 21, 2006, at 8:44 AM, Tommy Nordgren wrote:

     out_name = [fileName cString];
     writing = fopen(out_name, "w");
    fprintf(writing, everything); //looping over the matrix

This works, but I am afraid that it will break when the fileName contains non-ASCII characters. Is there another fast way to write a large C-array to a file that does work with non-ASCII filenames?

Thanks in advance, Patrick


    Test with [filename UTF8String]
I have tested this with a small project, using Swedish characters


Don't use -cString ever! Don't use -UTF8String for filesystem names!

Use the method designed for this:  -fileSystemRepresentation.

If you're coming to WWDC, come to session 150 to find out why.

Look at NSPathUtilities.h and NSFileManager.h for more extensive methods for dealing with paths.

Douglas Davidson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >writing huge C-array to a file (From: PGM <email@hidden>)
 >Re: writing huge C-array to a file (From: Tommy Nordgren <email@hidden>)

  • Prev by Date: Re: NSOpenPanel and executable files
  • Next by Date: Re: application preferences
  • Previous by thread: Re: writing huge C-array to a file
  • Next by thread: Re: writing huge C-array to a file
  • Index(es):
    • Date
    • Thread