masoud
masoud

Reputation: 56479

Portable text based console manipulator

Applications can manipulate text based consoles or terminals, and change their colors, set cursor position. The supported approaches are:

but, is there any lightweight and portable C/C++ library which handles differences between operating systems just for colors and cursor? and do nothing if it was technically impossible but best effort.

Note: I'm not searching for heavy external tools to emulate unix-like terminals (like Cygwin, Msys-rxvt, ...). I think a simple portability will be achieved with Windows APIs and ANSI escape codes. And not ncurses because it's heavy and has many functionality to full control console and I think it needs emulation.

Upvotes: 21

Views: 9137

Answers (1)

masoud
masoud

Reputation: 56479

Alright, i finally found a portable and easy to use library: rlutil.h

Usage:

#include <iostream>
#include "rlutil.h"
int main()
{
    for (int i = 0; i < 16; i++)
    {
        rlutil::setColor(i);
        std::cout << i << " ";
    }
    std::cout << std::endl;
    return 0;
}

but, i will be glad for other suggestions.

Upvotes: 27

Related Questions