In function 'int main()':
30:17: error: 'TEST' was not declared in this scope
> Contents of file are exactly: \e[1;32m this is a test
Backslash escapes are only interpreted in things like source code and say the command prompt.
If you're reading from a file, every character stands for itself.
With the exception (for your platform) that \r\n combinations are transformed to \n on input.
If you want an actual escape character, then you need to replace the two characters '\e' with an actual escape character. How you do this depends on your text editor.
I am not sure what you are trying to do. But its possible its not supported directly; you may have to read the code from the file and parse it, send the correct code to the console, then push the file data through in that colored setting. Taken as a string, the codes are just text... you have to get the console to accept it as a command, and it may not do that if its with other text or something. I admit to not playing with these much, so I could be wrong.
> if anybody could explain to me why using the '\e' in the text file doesn't work, that would be awesome,
Because backslash escapes require some kind of parser, say
- your C++ compiler
- your shell
If you were reading a text file of path names, like c:\path\to\some\file.txt
c:\here\is\another\file.txt
Then backslash interpretation from doing things like getline(FILE, TEST); would become such an annoying PITA really fast that you'd be here asking "how do I turn off this *!$?! backslash processing!?".