Where does printf output go from a DLL?

 

Hi,


I have a DLL that contains a few functions that I call from my EA. The functions contain printf statements for debugging purposes, but even though I know the functions are being called successfully, I can't see any output from the printf statements.


Where do these get written to?

 
mjbrady:

I have a DLL that contains a few functions that I call from my EA. The functions contain printf statements for debugging purposes, but even though I know the functions are being called successfully, I can't see any output from the printf statements.

Where do these get written to?

They get written to the application's console, if it has one. I can't think of any (trivial) way of trapping this output other than starting terminal.exe with the standard syntax for piping console output to a file. For example:


terminal.exe >consolelog.txt


For reasons which are slightly obscure, this has the side-effect of preventing MT4 from logging on automatically at startup.


If I were you, I'd replace the use of printf() with something which logs information in a file. The next-most-simple alternative involves creating a console for the GUI app before you call printf(), and then redirecting STDOUT.

 
jjc:

They get written to the application's console, if it has one. I can't think of any (trivial) way of trapping this output other than starting terminal.exe with the standard syntax for piping console output to a file. For example:


terminal.exe >consolelog.txt


For reasons which are slightly obscure, this has the side-effect of preventing MT4 from logging on automatically at startup.


If I were you, I'd replace the use of printf() with something which logs information in a file. The next-most-simple alternative involves creating a console for the GUI app before you call printf(), and then redirecting STDOUT.


 
Thanks for that jjc. Your explanation makes good sense....and I am now doing things the easier way and writing out to file.