Is it somehow possible to redirect the stderr to a file under MonoTouch?
In Objective-C you can do that with
freopen("file.log", "a+", stderr);
as described here and here.
But how can I do the same thing under MonoTouch?
The Xamarin Docs provide a section Working with the File System but I don't know hot to access the stderr stream from there.
Thanks in advance.
You do it the .NET way using Console.SetError.
OTOH it's often easier to do all your writing directly into your own TextWriter instance.
That will allow you to change the destination of the error output easily between the normal Console.Error, a file or anything else (e.g. Touch.Unit uses a writer that connect to a remove server socket).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With