NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
NSString *tmpPath = [path stringByAppendingPathComponent:@“temp”];
NSString* tempPathFile = [[Util getTempPath]
stringByAppendingPathComponent:[NSString stringWithFormat:@“test.pcm"]];
FILE* file = fopen([tempPath UTF8String],”wb”);
file一直返回null,原来是temp这个目录没有创建,需要先创建,如下:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
NSString *tmpPath = [path stringByAppendingPathComponent:@“temp”];
if (![self isFileExistAtPath:tmpPath]) {
[[NSFileManager defaultManager] createDirectoryAtP
NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
NSString *tmpPath = [path stringByAppendingPathComponent:@“temp”];
NSString* tempPathFile = [[Util getTempPath]
stringByAppendingPathComponent:[NSString stringWithFormat:@“test.pcm"]];
FILE* file = fopen([tempPath UTF8String],”wb”);
file一直返回null,原来是temp这个目录没有创建,需要先创建,如下:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
NSString *tmpPath = [path stringByAppendingPathComponent:@“temp”];
if (![self isFileExistAtPath:tmpPath]) {
[[NSFileManager defaultManager] createDirectoryAtP