I am trying to create a file by fopen and then write it, but weird things happened.
- When I plug in the iphone to the usb port. Everything works fine. A file is created at the tmp directory or the document directory as expected.
- When I plug off the device and do the same thing, the file did not appear. I was wondering why.
I use fopen to create the file. In my case, I should do this to create and then write the file. The call is fopen(pcm_output, “wb+”);
You need to use this call.
From the docs…
fileSystemRepresentationWithPath:
– (const char *)fileSystemRepresentationWithPath:(NSString *)path
iOS (2.0 and later)
Returns a C-string representation of a given path that properly encodes Unicode strings for use by the file system.
path: A string object containing a path to a file.
A C-string representation of path that properly encodes Unicode strings for use by the file system.