@OneRaynyDay I made a thing for you that shows the template idea. That is one part of turning static typing into dynamic typing so that you lose efficiency and turn compile time errors into runtime errors.
I had fun making it, but I would not recommend actually using something like that.
You can regain some performance by replacing the map with a vector and you don't have to use std::tuple, but I'm fairly sure the compiler will not be able to inline any of the operators so that adding 2 ints will have like a 10000% performance penalty.
@OneRaynyDay The abi::__cxa_demangle is the "//not necessary" part. It makes it so you turn i into int and NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE into std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > which somewhat helps readability.
How do I get colored text input? Say, running ls prints directories in blue and files in black. I can read the text output of ls using any of QProcess, fork, popen, ... but none of them seem to allow me to read the color.
@nwp ls is using isatty to detect whether it's sending output to the terminal or redirected, and so it decides whether to output formatted text or a plain newline separated list
You need to pass a flag to ls so it will always assume a terminal
I'm writing a program that reads input from stdin, manipulates the input, and writes output to stdout. However, many programs check whether stdin is a terminal or a pipe (by calling a function like isatty), and generate output differently. How do I have my program pretend to be a TTY?
The soluti...
Somehow this isn't enough. forkpty makes it so that isatty returns 1 and I mimicked the termios settings of zsh so that tcgetattr(STDOUT_FILENO returns the same settings, but I still only get plain text without any color control characters.