I am currently calling a DLL from labview, but I need to be able to debug it realtime (because of it's accessing time sensitive hardware). I would like to just printf() my error assert messages but I am unsure about how to open a DOS window from within the DLL to dump error information to. Has anyone done this before? I know I could do this with a file, and I may have to. printf is just such a handy quick and dirty way to do this though :) .
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
1) Make a call to the windows api AllocConsole.
2) You will probably need to call GetStdHandle to get stdout/stderr.
3) Printf to your hearts content!
回答2:
Instead of using printf() you can use Windows's OutputDebugString() function, and check the debug output in DebugView.