Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting stdout when p-invoking to unmanaged DLL?

Tags:

c#

stdout

pinvoke

I've got an unmanaged DLL that is writing log messages to standard output. I'm calling this DLL with P-invokes from a WPF app and I need to get the standard output stream log. I've tried Console.SetOut, but that only seems to capture information written using Console.Write, etc.

Anyone have any ideas? I've found similar questions asked elsewhere but they don't have answers.

like image 491
RandomEngy Avatar asked Feb 07 '10 00:02

RandomEngy


1 Answers

Since you're already calling PInvoke, I guess you wont mind an extra call to SetStdHandle. A similar thread is here Redirect stdout+stderr on a C# Windows service

like image 158
Mattias S Avatar answered Oct 23 '22 10:10

Mattias S