Capture console output from DLL in C#
-
Hi, I have a C++ dll that actually does the console output (either cout or printf). I am just wondering, how to capture this output so I could display it on my text box in C#. Thanks :)
Redirect standard input and standard output for the process. Being a Dll makes it more interesting because a dll shouldn't be outputting to standard streams.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway -
Redirect standard input and standard output for the process. Being a Dll makes it more interesting because a dll shouldn't be outputting to standard streams.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway -
Hi Ennis, How to redirect the standard output? I have been trying to redirect the standard output using Console.SetOut() but it doesn't do much. I am just wondering, what is the standard output in C#? And how to get it? Thanks :)
It is done from the Process class which is used to execute executables. Which is why I mentioned my comment about it being odd for a DLL to directly write to STD out.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway -
It is done from the Process class which is used to execute executables. Which is why I mentioned my comment about it being odd for a DLL to directly write to STD out.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway -
Hi Ennis, I did further testing. When I build my application as console C#, the DLL cout writes the output to the console window. But I can't capture it when I build my C# application as form application :(