Mar 31, 2016 at 1:38pm UTC
I have this code:
void text_color(string color1, string color2, string color3)
{
string colortmp, colortmp1;
if((color2 == "NULL") && (color3 == "NULL"))
{
colortmp = "FOREGROUND_" + color1;
SetConsoleTextAttribute(h, colortmp.c_str() | FOREGROUND_INTENSITY); // Error line
}
else if(color3 == "NULL")
{
colortmp = "FOREGROUND_" + color1;
colortmp1 = "FOREGROUND_" + color2;
SetConsoleTextAttribute(h, colortmp.c_str() | colortmp1.c_str() | FOREGROUND_INTENSITY); // Error line
}
else if(color2 == "NULL")
{
Sleep(1);
}
else if(color1 == "NULL")
{
SetConsoleTextAttribute ( h, wOldColorAttrs);
}
else
{
cout << endl << "error to load paint" << endl;
}
}
And error is:
invalid operands of types `const char*' and `int' to binary `operator|'
invalid operands of types `const char*' and `const char*' to binary `operator|'
please help
Last edited on Mar 31, 2016 at 1:38pm UTC
Mar 31, 2016 at 2:40pm UTC
I tryed set color of one for line text. But I could not run program. I don't know how I will continue. Can you help me to do differently?
Mar 31, 2016 at 3:12pm UTC
Last edited on Mar 31, 2016 at 3:14pm UTC
Mar 31, 2016 at 3:30pm UTC
I know this method but whether it can be done even with variables of type String
Mar 31, 2016 at 6:02pm UTC
Please. Can you show me extended code or show us an example? Because I don't know quite how to use it.
Last edited on Mar 31, 2016 at 6:02pm UTC
Apr 1, 2016 at 12:23pm UTC
Thank you very very very much. :)