To temporarily redirect stdout to a file, I'm doing:
printf("Before");
freopen_s(&stream, "test.txt", "w", stdout);
printf("During");
freopen_s(&stream, "CONOUT$", "w", stdout);
printf("After");
That works, however doing:
CONSOLE_SCREEN_BUFFER_INFO sbi = {0};
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &sbi);
No lon...
I want to be able to write the contents of NSLog to a file I specify, or I need a function that writes a log to a file, for example:
WriteLog(@"some activity by the user");
WriteLog(@"some more activity by the user");
but I want the output to look like this:
12-25-2009 1:30:00PM some activity by the user
12-25-2009 1:35:00PM some mor...
I'm using:
#if TARGET_IPHONE_SIMULATOR == 0
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *logPath = [documentsDirectory stringByAppendingPathComponent:@"console.log"];
freopen([logPath cStringUsingEncodin...
Please suggest a method to obtain a similar behaviour in Java as when we do freopen("filename","r",stdin) OR freopen("filename","w",stdout) in C.
...
Hi there,
I read about freopen to redirect all printf to a file, but I would like the output to be printed on the screen as well. Is there an easy way to redirect the printfs to a file and get the cmd line output?
Thanks!
...