简体   繁体   中英

Convert C++ Program with std::cout to NCurses / CDK

I have a large program written in C++ that uses std::cout in a lot of places. I am building an NCurses version and std::cout destroys that interface.

Is there a way to reroute the console output from std::cout to something like cdk_swindow ?

A simple way to do this would be to override the << operator. This way in your case you can use cdk_swindow

我记得std:cout在ncurses框架中不起作用,并且我使用了printf function ,您使用了带有sedregex并将std:cout转换为printf function 。但是无论如何它都是硬代码并且很脏。

I'd look at the CDK examples ( http://invisible-island.net/cdk/ )

Since CDK 'takes over' an Xterm, you probably will want to create a wrapper function that spews the text that used to go to the console, into something like CDKVIEWER.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM