samedi 13 février 2021

Problem outputing ANSI escape code from a file (C++)

I am working on a toy project. Basically, it's a set of classes and functions for making games that run in terminal. I want to use ANSI escape codes to change text color, style, background color and etc. I am trying to input shapes and colors from text files. I'm storing them in a class, which contains an array of strings (for the shapes) and a 2D array of strings (for the colors). When I hard code the colors it works fine, but when I input them from a file (using ifstream) it just outputs the codes and does nothing to the text style.

Is there a way to solve this problem without writing a separate function to process the inputted codes?

Thanks in advance!

P.S. I am running Linux (windows-specific solutions won't work for me).

Aucun commentaire:

Enregistrer un commentaire