How to catch printf from a dll?

Posted by Xarx on Stack Overflow See other posts from Stack Overflow or by Xarx
Published on 2012-03-23T14:13:14Z Indexed on 2012/03/23 23:29 UTC
Read the original article Hit count: 318

Filed under:
|
|
|
|

I've got a C++ console application that uses a third-party dll (jvm.dll, indirectly) that uses printf to print various error messages (Java stacktrace). I need to catch these stacktraces to a string in order to process them further, or at least to see them printed on the console.

The thing is that I see the stacktrace only when debugging my application in VisualStudio (VS 2010). When I run my application in the "normal way", i.e. from the command line, nothing is printed on the console. So VS is able to somehow interfere the java output and display it. I need to be able to do the same thing.

I've already tried freopen(), but without success. Also, I've found this question on the same problem, but without a clear answer.

© Stack Overflow or respective owner

Related posts about java

Related posts about Windows