Avi Turner
Avi Turner

Reputation: 10456

Writing to Output window from a c++ called by C#

I have a solution that is mostly C#, but has also few C++ projects.
At some point I call a c++ dll from C# code.

Is there a way to write to visual studio output window from the c++ code (for debugging purposes)? I tried printf but it did not seem to have any effect...

(I am using VS 2012, .Net 4.5)

Upvotes: 2

Views: 198

Answers (1)

Simon Mourier
Simon Mourier

Reputation: 138950

You can use the OutputDebugString function.

If you want to support variable arguments (like printf), you need to add a bit more code as in this answer: How do you create a debug only function that takes a variable argument list? Like printf()

Upvotes: 1

Related Questions