Roosty,
You can create a class that derives from TextWriter, overriding the
Write method (that takes a single character) and then having that fire an
event every time a character is written. Then, you can just call SetOut on
the Console class, passing an instance of your TextWriter.
You would then hook to an event on your text writer, which is fired
every time the character is written.
Overriding the Write method that takes a character is the minimum you
would have to do. However, this would result in a good number of events
being fired.
You could override some of the more specific methods, if you wish, for
the sake of performance.
This should capture the results of writing to cout from your unmanaged
DLL, and then you can display them anyway you wish.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Roosty" <ro******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hello,
i've been dealing with this problem whole morning, but havent quite
figured out the solution. The thing is: i have a C# program that calls
a function from a C++ dll. While running, the function uses "cout" a
lot, to print out useful data. Now here is the problem: this data is
being written in an output window and i want to redirect this data to
an application window or a text box. If thats not possible, then the
data should be at least written to a console window, that would come
up, when this function is called.
Any help would be greatly appreciated, thanks