- (NSString
*)getConsoleLogFilePath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
if (!documentsDirectory) {
NSLog(@"Documents directory not found!");
return nil;
}
return [documentsDirectory stringByAppendingPathComponent:fileName];
}
NSString *fileName = @"xx.log";
NSString *logFilePath = [self getConsoleLogFilePath];
freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
if (!documentsDirectory) {
NSLog(@"Documents directory not found!");
return nil;
}
return [documentsDirectory stringByAppendingPathComponent:fileName];
}
NSString *fileName = @"xx.log";
NSString *logFilePath = [self getConsoleLogFilePath];
freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr);
No comments:
Post a Comment