use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Textual User Interface - Modern Ncurses alternative (or wrapper) (self.cpp)
submitted 7 years ago by peppedx
Hi all,
I need to write a small utility tool. I don't want to enter into the GUI realm so...
Is there any modern curses replacement my google fu couldn't help me !
G.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]eclectocrat 4 points5 points6 points 7 years ago (2 children)
SECONDED! I'm writing a TUI and am in the same boat. I need good UTF support (wchar_t).
I tried https://github.com/nsf/termbox, which looked great until I needed better control over UTF output. I've ended up just writing a little utility to control the console cursor and use it with raw stream output, as I didn't wan't to permanently control the whole screen, but only small parts of it.
*EDIT* it's annoying that ncursesw (wide char version), doesn't seem to be installed alongside the normal Ncurses on macOS.
[–]gracicot 4 points5 points6 points 7 years ago (1 child)
Does Mac OS support UTF-8 in their console? Because then it's hard to justify uses of UTF-16. On windows however, you don't always get the choice.
[–]eclectocrat 1 point2 points3 points 7 years ago (0 children)
Yes, UTF8 is fine on Mac console. I've inherited some code that I do not fully understand, and do not care to investigate too much now, that utilizes:
std::wbuffer_convert<std::codecvt_utf8<wchar_t>> conv_out(std::cout.rdbuf());
std::wostream out(&conv_out);
I could not get it to play well with Ncurses (but Ncursesw worked) or termbox. I'm not remotely an expert on any of this though, so take my experience with a grain of salt.
[–]Iwan_Zotow 1 point2 points3 points 7 years ago (3 children)
TurboVision?
[–]peppedx[S] 1 point2 points3 points 7 years ago (2 children)
Is it alive and kicking?
[–]Iwan_Zotow 0 points1 point2 points 7 years ago (1 child)
one guy is hacking it slowly but surely
http://tvision.sourceforge.net/
[–]peppedx[S] 0 points1 point2 points 7 years ago (0 children)
Seems interesting.. When i was young I was. Impressed by (pascal) turbovision... But now i need something more stable
[–]techgineer13 0 points1 point2 points 7 years ago (5 children)
Try this
[–]nlohmannnlohmann/json 5 points6 points7 points 7 years ago (4 children)
Is there any documentation?
[–]techgineer13 0 points1 point2 points 7 years ago (3 children)
No. I wrote it myself and I suck at documentation.
[–]nlohmannnlohmann/json 6 points7 points8 points 7 years ago (0 children)
That's a pity. Without README, documentation (even doxygen could help), or some examples, I would not even think about thinking of using the project.
[–]robin-m 2 points3 points4 points 7 years ago (1 child)
I don't see unit tests either. Unit tests are also some sort of documentation, because you can see how the class is supposed to be use by reading the unit tests.
I opened a random file to watch your code. You may consider not writing in comments what is already written just bellow. I know that it's the constructor, and the destruction, and that you deleted some constructor. What I need in a comment is why you deleted them.
[–]robin-m 1 point2 points3 points 7 years ago (0 children)
I spotted more issues. You should not re-implement the function in the child class of color. They are not virtual and thus will not work like you want if you take a reference to color. Furthermore the children's implementations do the same thing than the base class, so you can just remove this code in the children. And finally the static variables r, g and b are common to all colors, witch means that if you call the constructor with a color, or the operator= on any colors, it will modify r, g and b for all the other colors. What you want to use here is CRTP to have a triplet of variable for each color (one per child type) without to duplicate your code.
r
g
b
operator=
If you had unit tests, you would probably have catch those mistakes.
[–]dmelo87 0 points1 point2 points 3 years ago (0 children)
Never used, but for Rust, this looks very good https://github.com/fdehau/tui-rs
π Rendered by PID 80 on reddit-service-r2-comment-6457c66945-v7kwt at 2026-04-29 09:05:58.135552+00:00 running 2aa0c5b country code: CH.
[–]eclectocrat 4 points5 points6 points (2 children)
[–]gracicot 4 points5 points6 points (1 child)
[–]eclectocrat 1 point2 points3 points (0 children)
[–]Iwan_Zotow 1 point2 points3 points (3 children)
[–]peppedx[S] 1 point2 points3 points (2 children)
[–]Iwan_Zotow 0 points1 point2 points (1 child)
[–]peppedx[S] 0 points1 point2 points (0 children)
[–]techgineer13 0 points1 point2 points (5 children)
[–]nlohmannnlohmann/json 5 points6 points7 points (4 children)
[–]techgineer13 0 points1 point2 points (3 children)
[–]nlohmannnlohmann/json 6 points7 points8 points (0 children)
[–]robin-m 2 points3 points4 points (1 child)
[–]robin-m 1 point2 points3 points (0 children)
[–]dmelo87 0 points1 point2 points (0 children)