My application UI (.exe file) is built by c# (windows form application project), but my algorithm is written in c++ (dynamic link library). So I create a C++/CLI project to become intermediate between my c# application and c++ library, and it works well.
I want to have a console windows together with my c# windows form application. Then I refer to this http://stackoverflow.com/questions/160587/no-output-to-console-from-a-wpf-application
I set the application output to console type and I successfully to have a console windows with my application.
My question is : I am able to print some message in my c# windows form application ( Console.WriteLine ), and it appear in console window.
But why my cout or printf function in c++ library doesn't shows in the console window ?
Am I missing any step ?
You are missing a step of tying the standard output handles to your created console, that does not happen automatically.
Try, if this doesn't work you will need to mess with _open_osfhand and some other calls I don't remember right off:
freopen("CONOUT$", "w", stdout);
std::cout << "This works" << std::endl;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.