问题描述
我想创建和fopen一个文件,然后写出来,但奇怪的事情发生了。
I am trying to create a file by fopen and then write it, but weird things happened.
- 当我插上iphone到USB端口。一切工作正常。一个文件是在tmp目录或文件目录的预期。创建
- 当我插上了设备,做同样的事情,该文件并没有出现。我想知道这是为什么。
我用的fopen创建文件。就我而言,我应该这样做创建并写入文件。该呼叫的fopen(pcm_output,WB +);
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+");
推荐答案
您需要使用这个电话。
char const *path = [fileManager fileSystemRepresentationWithPath:url.path];
从文档...
fileSystemRe presentationWithPath:
- (为const char *)fileSystemRe presentationWithPath:(* NSString的)路径
fileSystemRepresentationWithPath:- (const char *)fileSystemRepresentationWithPath:(NSString *)path
的iOS(2.0及更高版本)
iOS (2.0 and later)
返回C字符串重新指定路径的presentation,适当带codeS统一code字符串的文件系统。
Returns a C-string representation of a given path that properly encodes Unicode strings for use by the file system.
路径:包含一个文件路径的String对象。
A C弦重路径presentation,适当带codeS统一code字符串由文件系统使用。
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.
这篇关于FOPEN的iOS上怪异的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!