标签:com todo and domain ror odi use efault nss
1. 写入文件
1 - (void)writelogToDocumentFolder 2 { 3 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 4 NSString *documentDirectory = [paths objectAtIndex:0]; 5 NSString *fileName = [NSString stringWithFormat:@"pandatv_file.log"]; 6 NSString *logFilePath = [documentDirectory stringByAppendingPathComponent:fileName]; 7 // 先删除已经存在的文件 8 NSFileManager *defaultManager = [NSFileManager defaultManager]; 9 [defaultManager removeItemAtPath:logFilePath error:nil]; 10 11 // 将log输入到文件 12 freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stdout); 13 freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stderr); 14 }
标签:com todo and domain ror odi use efault nss
原文地址:https://www.cnblogs.com/lz465350/p/9140276.html